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
900c3250
Commit
900c3250
authored
Jun 19, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Add JUnit 4 and the Vintage Engine sample"
See gh-17100
parent
9fafcda9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
32 deletions
+9
-32
pom.xml
spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml
+0
-22
MessageController.java
...junit-vintage/src/main/java/sample/MessageController.java
+1
-1
SampleJunitVintageApplicationTests.java
.../test/java/sample/SampleJunitVintageApplicationTests.java
+8
-9
No files found.
spring-boot-samples/spring-boot-sample-junit-vintage/pom.xml
View file @
900c3250
...
@@ -23,28 +23,6 @@
...
@@ -23,28 +23,6 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-junit-jupiter
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</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>
</plugin>
</plugins>
</build>
</project>
</project>
spring-boot-samples/spring-boot-sample-junit-vintage/src/main/java/sample/MessageController.java
View file @
900c3250
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
public
class
MessageController
{
class
MessageController
{
@GetMapping
(
"/hi"
)
@GetMapping
(
"/hi"
)
public
String
hello
()
{
public
String
hello
()
{
...
...
spring-boot-samples/spring-boot-sample-junit-vintage/src/test/java/sample/SampleJunitVintageApplicationTests.java
View file @
900c3250
...
@@ -20,24 +20,23 @@ import org.junit.Test;
...
@@ -20,24 +20,23 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.web.servlet.MockMvc
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
content
;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@
SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
@
WebMvcTest
public
class
SampleJunitVintageApplicationTests
{
public
class
SampleJunitVintageApplicationTests
{
@Autowired
@Autowired
private
TestRestTemplate
restTemplate
;
private
MockMvc
mockMvc
;
@Test
@Test
public
void
testMessage
()
{
public
void
testMessage
()
throws
Exception
{
String
message
=
this
.
restTemplate
.
getForObject
(
"/hi"
,
String
.
class
);
this
.
mockMvc
.
perform
(
get
(
"/hi"
)).
andExpect
(
content
().
string
(
"Hello World"
));
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