Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f1664db8
Commit
f1664db8
authored
Jan 20, 2017
by
Eddú Meléndez
Committed by
Stephane Nicoll
Jul 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JUnit Jupiter sample application
See gh-8048
parent
1c05afbc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
0 deletions
+183
-0
README.adoc
spring-boot-samples/README.adoc
+3
-0
pom.xml
spring-boot-samples/pom.xml
+1
-0
pom.xml
spring-boot-samples/spring-boot-sample-junit-jupiter/pom.xml
+75
-0
MessageController.java
...junit-jupiter/src/main/java/sample/MessageController.java
+33
-0
SampleJunitJupiterApplication.java
...r/src/main/java/sample/SampleJunitJupiterApplication.java
+28
-0
SampleJunitJupiterApplicationTests.java
.../test/java/sample/SampleJunitJupiterApplicationTests.java
+43
-0
No files found.
spring-boot-samples/README.adoc
View file @
f1664db8
...
...
@@ -132,6 +132,9 @@ The following sample applications are provided:
| link:spring-boot-sample-jta-narayana[spring-boot-sample-jta-narayana]
| JTA transactions with Narayana
| link:spring-boot-sample-junit-jupiter[spring-boot-sample-junit-jupiter]
| Demonstrates JUnit Jupiter-based testing
| link:spring-boot-sample-liquibase[spring-boot-sample-liquibase]
| Database migrations with Liquibase
...
...
spring-boot-samples/pom.xml
View file @
f1664db8
...
...
@@ -63,6 +63,7 @@
<module>
spring-boot-sample-jta-bitronix
</module>
<module>
spring-boot-sample-jta-narayana
</module>
<module>
spring-boot-sample-jta-jndi
</module>
<module>
spring-boot-sample-junit-jupiter
</module>
<module>
spring-boot-sample-liquibase
</module>
<module>
spring-boot-sample-logback
</module>
<module>
spring-boot-sample-metrics-dropwizard
</module>
...
...
spring-boot-samples/spring-boot-sample-junit-jupiter/pom.xml
0 → 100644
View file @
f1664db8
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
2.0.0.BUILD-SNAPSHOT
</version>
</parent>
<artifactId>
spring-boot-sample-junit-jupiter
</artifactId>
<name>
Spring Boot JUnit Jupiter Sample
</name>
<description>
Spring Boot JUnit Jupiter Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<name>
Pivotal Software, Inc.
</name>
<url>
http://www.spring.io
</url>
</organization>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
<junit.jupiter.version>
5.0.0-M5
</junit.jupiter.version>
<junit.platform.version>
1.0.0-M5
</junit.platform.version>
</properties>
<dependencies>
<!-- Compile -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-api
</artifactId>
<version>
${junit.jupiter.version}
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<dependencies>
<dependency>
<groupId>
org.junit.platform
</groupId>
<artifactId>
junit-platform-surefire-provider
</artifactId>
<version>
${junit.platform.version}
</version>
</dependency>
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter-engine
</artifactId>
<version>
${junit.jupiter.version}
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
spring-boot-samples/spring-boot-sample-junit-jupiter/src/main/java/sample/MessageController.java
0 → 100644
View file @
f1664db8
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author Eddú Meléndez
*/
@RestController
public
class
MessageController
{
@GetMapping
(
"/hi"
)
public
String
hello
()
{
return
"Hello World"
;
}
}
spring-boot-samples/spring-boot-sample-junit-jupiter/src/main/java/sample/SampleJunitJupiterApplication.java
0 → 100644
View file @
f1664db8
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
SampleJunitJupiterApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SampleJunitJupiterApplication
.
class
,
args
);
}
}
spring-boot-samples/spring-boot-sample-junit-jupiter/src/test/java/sample/SampleJunitJupiterApplicationTests.java
0 → 100644
View file @
f1664db8
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
sample
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@ExtendWith
(
SpringExtension
.
class
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
class
SampleJunitJupiterApplicationTests
{
@Autowired
private
TestRestTemplate
restTemplate
;
@Test
void
testMessage
()
{
String
message
=
this
.
restTemplate
.
getForObject
(
"/hi"
,
String
.
class
);
assertThat
(
message
).
isEqualTo
(
"Hello World"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment