Skip to content

Commit 0b60111

Browse files
committed
Modularize spring-boot-test
Closes gh-46356
1 parent 5348880 commit 0b60111

File tree

62 files changed

+112
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+112
-105
lines changed

core/spring-boot-test/build.gradle

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,18 @@ dependencies {
2727
api(project(":core:spring-boot"))
2828
api("org.springframework:spring-test")
2929

30-
optional("com.google.code.gson:gson")
31-
optional("com.jayway.jsonpath:json-path")
32-
optional("io.projectreactor.netty:reactor-netty-http")
33-
optional("jakarta.json.bind:jakarta.json.bind-api")
3430
optional("jakarta.servlet:jakarta.servlet-api")
3531
optional("junit:junit")
36-
optional("org.apache.httpcomponents.client5:httpclient5")
3732
optional("org.assertj:assertj-core")
3833
optional("org.hamcrest:hamcrest-core")
3934
optional("org.hamcrest:hamcrest-library")
4035
optional("org.junit.jupiter:junit-jupiter-api")
4136
optional("org.mockito:mockito-core")
42-
optional("org.skyscreamer:jsonassert")
4337
optional("org.springframework:spring-web")
44-
optional("org.springframework:spring-webflux")
45-
optional("org.springframework.graphql:spring-graphql-test")
46-
optional("tools.jackson.core:jackson-databind")
4738

4839
testImplementation(project(":test-support:spring-boot-test-support"))
4940
testImplementation("ch.qos.logback:logback-classic")
50-
testImplementation("io.mockk:mockk")
51-
testImplementation("jakarta.json:jakarta.json-api")
52-
testImplementation("org.apache.groovy:groovy")
53-
testImplementation("org.apache.groovy:groovy-xml")
54-
testImplementation("org.eclipse:yasson")
41+
testImplementation("com.google.code.gson:gson")
5542
testImplementation("org.jetbrains.kotlin:kotlin-reflect")
5643
testImplementation("org.jetbrains.kotlin:kotlin-stdlib")
5744
testImplementation("org.slf4j:slf4j-api")

core/spring-boot-test/src/main/resources/META-INF/spring.factories

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Spring Test Context Customizer Factories
22
org.springframework.test.context.ContextCustomizerFactory=\
33
org.springframework.boot.test.context.ImportsContextCustomizerFactory,\
4-
org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory,\
5-
org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory
4+
org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizerFactory
65

76
# Application Context Initializers
87
org.springframework.context.ApplicationContextInitializer=\

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ TIP: A list of the auto-configurations that are enabled by javadoc:org.springfra
290290
If you need to configure elements of the auto-configuration, you can use the javadoc:org.springframework.boot.json.test.autoconfigure.AutoConfigureJsonTesters[format=annotation] annotation.
291291

292292
Spring Boot includes AssertJ-based helpers that work with the JSONAssert and JsonPath libraries to check that JSON appears as expected.
293-
The javadoc:org.springframework.boot.test.json.JacksonTester[], javadoc:org.springframework.boot.test.json.GsonTester[], javadoc:org.springframework.boot.test.json.JsonbTester[], and javadoc:org.springframework.boot.test.json.BasicJsonTester[] classes can be used for Jackson, Gson, Jsonb, and Strings respectively.
293+
The javadoc:org.springframework.boot.json.test.JacksonTester[], javadoc:org.springframework.boot.json.test.GsonTester[], javadoc:org.springframework.boot.json.test.JsonbTester[], and javadoc:org.springframework.boot.json.test.BasicJsonTester[] classes can be used for Jackson, Gson, Jsonb, and Strings respectively.
294294
Any helper fields on the test class can be javadoc:org.springframework.beans.factory.annotation.Autowired[format=annotation] when using javadoc:org.springframework.boot.json.test.autoconfigure.JsonTest[format=annotation].
295295
The following example shows a test class for Jackson:
296296

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/jsontests/MyJsonAssertJTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.annotation.Autowired;
22+
import org.springframework.boot.json.test.JacksonTester;
2223
import org.springframework.boot.json.test.autoconfigure.JsonTest;
23-
import org.springframework.boot.test.json.JacksonTester;
2424

2525
import static org.assertj.core.api.Assertions.assertThat;
2626
import static org.assertj.core.api.Assertions.within;

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/jsontests/MyJsonTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.annotation.Autowired;
22+
import org.springframework.boot.json.test.JacksonTester;
2223
import org.springframework.boot.json.test.autoconfigure.JsonTest;
23-
import org.springframework.boot.test.json.JacksonTester;
2424

2525
import static org.assertj.core.api.Assertions.assertThat;
2626

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/jsontests/MyJsonAssertJTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.assertj.core.api.ThrowingConsumer
2222
import org.junit.jupiter.api.Test
2323
import org.springframework.beans.factory.annotation.Autowired
2424
import org.springframework.boot.json.test.autoconfigure.JsonTest
25-
import org.springframework.boot.test.json.JacksonTester
25+
import org.springframework.boot.json.test.JacksonTester
2626

2727
@JsonTest
2828
class MyJsonAssertJTests(@Autowired val json: JacksonTester<SomeObject>) {

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/springbootapplications/jsontests/MyJsonTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import org.assertj.core.api.Assertions.assertThat
2020
import org.junit.jupiter.api.Test
2121
import org.springframework.beans.factory.annotation.Autowired
2222
import org.springframework.boot.json.test.autoconfigure.JsonTest
23-
import org.springframework.boot.test.json.JacksonTester
23+
import org.springframework.boot.json.test.JacksonTester
2424

2525
@JsonTest
2626
class MyJsonTests(@Autowired val json: JacksonTester<VehicleDetails>) {

module/spring-boot-actuator/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ dependencies {
6565
testImplementation(project(":core:spring-boot-test"))
6666
testImplementation(project(":module:spring-boot-jackson"))
6767
testImplementation(project(":module:spring-boot-jsonb"))
68+
testImplementation(project(":module:spring-boot-json-test"))
6869
testImplementation(project(":test-support:spring-boot-test-support"))
6970
testImplementation("io.micrometer:micrometer-observation-test")
7071
testImplementation("io.projectreactor:reactor-test")

module/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapperTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import tools.jackson.databind.JavaType;
2828
import tools.jackson.databind.ObjectMapper;
2929

30-
import org.springframework.boot.test.json.BasicJsonTester;
30+
import org.springframework.boot.json.test.BasicJsonTester;
3131

3232
import static org.assertj.core.api.Assertions.assertThat;
3333
import static org.mockito.ArgumentMatchers.any;

module/spring-boot-json-test/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ dependencies {
3232
optional(project(":module:spring-boot-jsonb"))
3333
optional(project(":module:spring-boot-kotlin-serialization"))
3434
optional(project(":module:spring-boot-test-autoconfigure"))
35+
optional("com.jayway.jsonpath:json-path")
36+
optional("org.assertj:assertj-core")
3537
optional("org.junit.jupiter:junit-jupiter-api")
38+
optional("org.skyscreamer:jsonassert")
3639

3740
testImplementation(project(":test-support:spring-boot-test-support"))
3841

0 commit comments

Comments
 (0)