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
93bcc3dc
Commit
93bcc3dc
authored
Jul 14, 2019
by
wonwoo
Committed by
Stephane Nicoll
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation to use JUnit Jupiter
See gh-17507
parent
e5b596c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
27 deletions
+19
-27
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+15
-18
UsersDocumentationTests.java
...configure/restdocs/webclient/UsersDocumentationTests.java
+1
-4
MockMvcExampleTests.java
...ringframework/boot/docs/test/web/MockMvcExampleTests.java
+2
-1
RandomPortWebTestClientExampleTests.java
...ot/docs/test/web/RandomPortWebTestClientExampleTests.java
+1
-1
SampleWebClientTests.java
...gframework/boot/docs/web/client/SampleWebClientTests.java
+0
-3
No files found.
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
93bcc3dc
...
...
@@ -7023,9 +7023,8 @@ property:
[source,java,indent=0]
----
@RunWith(SpringRunner.class)
@SpringBootTest(properties = "spring.main.web-application-type=reactive")
public
class MyWebFluxTests { ... }
class MyWebFluxTests { ... }
----
...
...
@@ -7088,10 +7087,10 @@ that class explicitly where it is required, as shown in the following example:
----
@SpringBootTest
@Import(MyTestsConfiguration.class)
public
class MyTests {
class MyTests {
@Test
public
void exampleTest() {
void exampleTest() {
...
}
...
...
@@ -7345,7 +7344,7 @@ Strings respectively. Any helper fields on the test class can be `@Autowired` wh
}
@Test
public
void testDeserialize() throws Exception {
void testDeserialize() throws Exception {
String content = "{\"make\":\"Ford\",\"model\":\"Focus\"}";
assertThat(this.json.parse(content))
.isEqualTo(new VehicleDetails("Ford", "Focus"));
...
...
@@ -7636,10 +7635,9 @@ following example:
[source,java,indent=0]
----
@RunWith(SpringRunner.class)
@DataJpaTest
@AutoConfigureTestDatabase(replace=Replace.NONE)
public
class ExampleRepositoryTests {
class ExampleRepositoryTests {
// ...
...
...
@@ -7765,7 +7763,7 @@ The following class shows the `@DataMongoTest` annotation in use:
import org.springframework.data.mongodb.core.MongoTemplate;
@DataMongoTest
public
class ExampleDataMongoTests {
class ExampleDataMongoTests {
@Autowired
private MongoTemplate mongoTemplate;
...
...
@@ -7785,7 +7783,7 @@ the following example:
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
@DataMongoTest(excludeAutoConfiguration = EmbeddedMongoAutoConfiguration.class)
public
class ExampleDataMongoNonEmbeddedTests {
class ExampleDataMongoNonEmbeddedTests {
}
----
...
...
@@ -7812,7 +7810,7 @@ The following example shows a typical setup for using Neo4J tests in Spring Boot
import org.springframework.boot.test.autoconfigure.data.neo4j.DataNeo4jTest;
@DataNeo4jTest
public
class ExampleDataNeo4jTests {
class ExampleDataNeo4jTests {
@Autowired
private YourRepository repository;
...
...
@@ -7835,7 +7833,7 @@ as follows:
@DataNeo4jTest
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public
class ExampleNonTransactionalTests {
class ExampleNonTransactionalTests {
}
----
...
...
@@ -7861,7 +7859,7 @@ The following example shows the `@DataRedisTest` annotation in use:
import org.springframework.boot.test.autoconfigure.data.redis.DataRedisTest;
@DataRedisTest
public
class ExampleDataRedisTests {
class ExampleDataRedisTests {
@Autowired
private YourRepository repository;
...
...
@@ -7892,7 +7890,7 @@ The following example shows the `@DataLdapTest` annotation in use:
import org.springframework.ldap.core.LdapTemplate;
@DataLdapTest
public
class ExampleDataLdapTests {
class ExampleDataLdapTests {
@Autowired
private LdapTemplate ldapTemplate;
...
...
@@ -7912,7 +7910,7 @@ following example:
import org.springframework.boot.test.autoconfigure.data.ldap.DataLdapTest;
@DataLdapTest(excludeAutoConfiguration = EmbeddedLdapAutoConfiguration.class)
public
class ExampleDataLdapNonEmbeddedTests {
class ExampleDataLdapNonEmbeddedTests {
}
----
...
...
@@ -7935,7 +7933,7 @@ The specific beans that you want to test should be specified by using the `value
[source,java,indent=0]
----
@RestClientTest(RemoteVehicleDetailsService.class)
public
class ExampleRestClientTest {
class ExampleRestClientTest {
@Autowired
private RemoteVehicleDetailsService service;
...
...
@@ -7944,7 +7942,7 @@ The specific beans that you want to test should be specified by using the `value
private MockRestServiceServer server;
@Test
public
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails()
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails()
throws Exception {
this.server.expect(requestTo("/greet/details"))
.andRespond(withSuccess("hello", MediaType.TEXT_PLAIN));
...
...
@@ -8099,10 +8097,9 @@ simply by adding `@ImportAutoConfiguration` to the test as shown in the followin
[source,java,indent=0]
----
@RunWith(SpringRunner.class)
@JdbcTest
@ImportAutoConfiguration(IntegrationAutoConfiguration.class)
public
class ExampleJdbcTests {
class ExampleJdbcTests {
}
----
...
...
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/UsersDocumentationTests.java
View file @
93bcc3dc
...
...
@@ -18,20 +18,17 @@ package org.springframework.boot.docs.test.autoconfigure.restdocs.webclient;
// tag::source[]
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.autoconfigure.restdocs.AutoConfigureRestDocs
;
import
org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
org.springframework.test.web.reactive.server.WebTestClient
;
import
static
org
.
springframework
.
restdocs
.
webtestclient
.
WebTestClientRestDocumentation
.
document
;
@ExtendWith
(
SpringExtension
.
class
)
@WebFluxTest
@AutoConfigureRestDocs
public
class
UsersDocumentationTests
{
class
UsersDocumentationTests
{
@Autowired
private
WebTestClient
webTestClient
;
...
...
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/web/MockMvcExampleTests.java
View file @
93bcc3dc
...
...
@@ -20,6 +20,7 @@ package org.springframework.boot.docs.test.web;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.web.servlet.MockMvc
;
...
...
@@ -33,7 +34,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
class
MockMvcExampleTests
{
@Test
void
exampleTest
(
MockMvc
mvc
)
throws
Exception
{
void
exampleTest
(
@Autowired
MockMvc
mvc
)
throws
Exception
{
mvc
.
perform
(
get
(
"/"
)).
andExpect
(
status
().
isOk
()).
andExpect
(
content
().
string
(
"Hello World"
));
}
...
...
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/web/RandomPortWebTestClientExampleTests.java
View file @
93bcc3dc
...
...
@@ -26,7 +26,7 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import
org.springframework.test.web.reactive.server.WebTestClient
;
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
public
class
RandomPortWebTestClientExampleTests
{
class
RandomPortWebTestClientExampleTests
{
@Test
void
exampleTest
(
@Autowired
WebTestClient
webClient
)
{
...
...
spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/docs/web/client/SampleWebClientTests.java
View file @
93bcc3dc
...
...
@@ -19,7 +19,6 @@ package org.springframework.boot.docs.web.client;
import
java.time.Duration
;
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
;
...
...
@@ -29,7 +28,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate;
import
org.springframework.boot.web.client.RestTemplateBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.test.context.junit.jupiter.SpringExtension
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -39,7 +37,6 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
*/
// tag::test[]
@ExtendWith
(
SpringExtension
.
class
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
class
SampleWebClientTests
{
...
...
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