Skip to content

Commit 363adde

Browse files
committed
➕ Switch dependency to more specific spring-boot-starter-jersey-test
1 parent a19db87 commit 363adde

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

spring/fluentforms-jersey-spring-boot-autoconfigure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<!-- Testing Dependencies -->
9595
<dependency>
9696
<groupId>org.springframework.boot</groupId>
97-
<artifactId>spring-boot-starter-test</artifactId>
97+
<artifactId>spring-boot-starter-jersey-test</artifactId>
9898
<scope>test</scope>
9999
</dependency>
100100
<dependency>

spring/fluentforms-jersey-spring-boot-autoconfigure/src/test/java/com/_4point/aem/fluentforms/spring/JerseyAutoConfigurationTest.java

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.junit.jupiter.api.Test;
77
import org.mockito.Mockito;
88
import org.springframework.boot.autoconfigure.AutoConfigurations;
9+
import org.springframework.boot.restclient.autoconfigure.RestClientSsl;
910
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
1011
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
1112
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -33,23 +34,27 @@ class JerseyAutoConfigurationTest {
3334
* This class provides mock versions of beans that would normally be provided by Spring Boot in a real application. We
3435
* only need to mock out the RestClient.Builder and RestClientSsl beans because those are the only Spring Boot provided
3536
* beans that our AutoConfigurations depend on.
37+
*
38+
* In theory, we should not need to provide these however spring-boot-starter-jersey brings in spring-boot-restclient
39+
* on to the test classpath which, in turn, triggers the inclusion of the fluent-forms springRestClientFactory which
40+
* requires the mocks.
3641
*/
3742
private static class SpringBootMocks {
3843
@Bean RestClient.Builder mockRestClientBuilder() { return Mockito.mock(RestClient.Builder.class, Mockito.RETURNS_DEEP_STUBS); }
39-
// @Bean private RestClientSsl mockRestClientSsl() { return Mockito.mock(RestClientSsl.class); }
44+
@Bean private RestClientSsl mockRestClientSsl() { return Mockito.mock(RestClientSsl.class); }
4045
}
4146

42-
private static final AutoConfigurations AUTO_CONFIG = AutoConfigurations.of(FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, AemProxyAutoConfiguration.class, SpringBootMocks.class);
47+
private static final AutoConfigurations AUTO_CONFIG = AutoConfigurations.of(FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, SpringBootMocks.class);
4348

44-
private static final AutoConfigurations LOCAL_SUBMIT_CONFIG = AutoConfigurations.of(FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, AemProxyAutoConfiguration.class, DummyLocalSubmitHandler.class, SpringBootMocks.class);
49+
private static final AutoConfigurations LOCAL_SUBMIT_CONFIG = AutoConfigurations.of(FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, DummyLocalSubmitHandler.class, SpringBootMocks.class);
4550

46-
private static final AutoConfigurations ALTERNATE_PROXY_CONFIG = AutoConfigurations.of(DummyProxyImplementation.class, FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, AemProxyAutoConfiguration.class, SpringBootMocks.class);
51+
private static final AutoConfigurations ALTERNATE_PROXY_CONFIG = AutoConfigurations.of(DummyProxyImplementation.class, FluentFormsJerseyAutoConfiguration.class, AemProxyJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class, SpringBootMocks.class);
4752

4853
// Tests to make sure that only the FluentFormsLibraries are loaded in a non-web application.
4954
private static final ContextConsumer<? super AssertableApplicationContext> FF_LIBRARIES_ONLY = (context) -> {
5055
assertAll(
51-
()->assertThat(context).hasSingleBean(FluentFormsAutoConfiguration.class),
52-
()->assertThat(context).getBean(FluentFormsAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsAutoConfiguration.class)),
56+
()->assertThat(context).hasSingleBean(FluentFormsJerseyAutoConfiguration.class),
57+
()->assertThat(context).getBean(FluentFormsJerseyAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsJerseyAutoConfiguration.class)),
5358
()->assertThat(context).hasSingleBean(OutputService.class),
5459
()->assertThat(context).getBean("outputService").isNotNull(),
5560
()->assertThat(context).doesNotHaveBean(AemProxyAutoConfiguration.class),
@@ -63,8 +68,8 @@ private static class SpringBootMocks {
6368
// Tests to make sure that only the FluentFormsLibraries are loaded in a web application.
6469
private static final ContextConsumer<? super AssertableWebApplicationContext> WEB_FF_LIBRARIES_ONLY = (context) -> {
6570
assertAll(
66-
()->assertThat(context).hasSingleBean(FluentFormsAutoConfiguration.class),
67-
()->assertThat(context).getBean(FluentFormsAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsAutoConfiguration.class)),
71+
()->assertThat(context).hasSingleBean(FluentFormsJerseyAutoConfiguration.class),
72+
()->assertThat(context).getBean(FluentFormsJerseyAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsJerseyAutoConfiguration.class)),
6873
()->assertThat(context).hasSingleBean(OutputService.class),
6974
()->assertThat(context).getBean("outputService").isNotNull(),
7075
()->assertThat(context).doesNotHaveBean(AemProxyAutoConfiguration.class),
@@ -78,8 +83,8 @@ private static class SpringBootMocks {
7883
// Tests to make sure that all beans are loaded by default in a web application.
7984
private static final ContextConsumer<? super AssertableWebApplicationContext> WEB_ALL_DEFAULT_SERVICES = (context) -> {
8085
assertAll(
81-
()->assertThat(context).hasSingleBean(FluentFormsAutoConfiguration.class),
82-
()->assertThat(context).getBean(FluentFormsAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsAutoConfiguration.class)),
86+
()->assertThat(context).hasSingleBean(FluentFormsJerseyAutoConfiguration.class),
87+
()->assertThat(context).getBean(FluentFormsJerseyAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsJerseyAutoConfiguration.class)),
8388
()->assertThat(context).hasSingleBean(OutputService.class),
8489
()->assertThat(context).getBean("outputService").isNotNull(),
8590
()->assertThat(context).hasSingleBean(AemProxyJerseyAutoConfiguration.class),
@@ -91,27 +96,27 @@ private static class SpringBootMocks {
9196
};
9297

9398
// Tests to make sure that all beans are loaded by default in a web application.
94-
private static final ContextConsumer<? super AssertableWebApplicationContext> WEB_ALL_SPRINGMVC_SERVICES = (context) -> {
95-
assertAll(
96-
()->assertThat(context).hasSingleBean(FluentFormsAutoConfiguration.class),
97-
()->assertThat(context).getBean(FluentFormsAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsAutoConfiguration.class)),
98-
()->assertThat(context).hasSingleBean(OutputService.class),
99-
()->assertThat(context).getBean("outputService").isNotNull(),
100-
()->assertThat(context).hasSingleBean(AemProxyAutoConfiguration.class),
101-
()->assertThat(context).getBean(AemProxyAutoConfiguration.class.getName()).isSameAs(context.getBean(AemProxyAutoConfiguration.class)),
102-
()->assertThat(context).hasSingleBean(SpringAfSubmitProcessor.class),
103-
()->assertThat(context).getBean(SpringAfSubmitProcessor.class).isSameAs(context.getBean(AemProxyAfSubmission.AfSubmitAemProxyProcessor.class)),
104-
()->assertThat(context).doesNotHaveBean(AfSubmissionHandler.class),
105-
()->assertThat(context).doesNotHaveBean(AemProxyJerseyAutoConfiguration.class),
106-
()->assertThat(context).doesNotHaveBean(JerseyAfSubmitProcessor.class)
107-
);
108-
};
99+
// private static final ContextConsumer<? super AssertableWebApplicationContext> WEB_ALL_SPRINGMVC_SERVICES = (context) -> {
100+
// assertAll(
101+
// ()->assertThat(context).hasSingleBean(FluentFormsJerseyAutoConfiguration.class),
102+
// ()->assertThat(context).getBean(FluentFormsJerseyAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsJerseyAutoConfiguration.class)),
103+
// ()->assertThat(context).hasSingleBean(OutputService.class),
104+
// ()->assertThat(context).getBean("outputService").isNotNull(),
105+
// ()->assertThat(context).hasSingleBean(AemProxyAutoConfiguration.class),
106+
// ()->assertThat(context).getBean(AemProxyAutoConfiguration.class.getName()).isSameAs(context.getBean(AemProxyAutoConfiguration.class)),
107+
// ()->assertThat(context).hasSingleBean(SpringAfSubmitProcessor.class),
108+
// ()->assertThat(context).getBean(SpringAfSubmitProcessor.class).isSameAs(context.getBean(AemProxyAfSubmission.AfSubmitAemProxyProcessor.class)),
109+
// ()->assertThat(context).doesNotHaveBean(AfSubmissionHandler.class),
110+
// ()->assertThat(context).doesNotHaveBean(AemProxyJerseyAutoConfiguration.class),
111+
// ()->assertThat(context).doesNotHaveBean(JerseyAfSubmitProcessor.class)
112+
// );
113+
// };
109114

110115
// Tests to make sure that all beans are loaded in a web application that contains a local submit handler.
111116
private static final ContextConsumer<? super AssertableWebApplicationContext> WEB_LOCAL_SUBMIT_SERVICES = (context) -> {
112117
assertAll(
113-
()->assertThat(context).hasSingleBean(FluentFormsAutoConfiguration.class),
114-
()->assertThat(context).getBean(FluentFormsAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsAutoConfiguration.class)),
118+
()->assertThat(context).hasSingleBean(FluentFormsJerseyAutoConfiguration.class),
119+
()->assertThat(context).getBean(FluentFormsJerseyAutoConfiguration.class.getName()).isSameAs(context.getBean(FluentFormsJerseyAutoConfiguration.class)),
115120
()->assertThat(context).hasSingleBean(OutputService.class),
116121
()->assertThat(context).getBean("outputService").isNotNull(),
117122
()->assertThat(context).hasSingleBean(AemProxyJerseyAutoConfiguration.class),

spring/fluentforms-sample-web-jersey-app/pom.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
</repositories>
4242

4343
<dependencies>
44-
<dependency>
45-
<groupId>org.springframework.boot</groupId>
46-
<artifactId>spring-boot-starter</artifactId>
47-
</dependency>
4844
<dependency>
4945
<groupId>org.springframework.boot</groupId>
5046
<artifactId>spring-boot-starter-jersey</artifactId>
@@ -74,7 +70,7 @@
7470
<!-- Testing Dependencies -->
7571
<dependency>
7672
<groupId>org.springframework.boot</groupId>
77-
<artifactId>spring-boot-starter-test</artifactId>
73+
<artifactId>spring-boot-starter-jersey-test</artifactId>
7874
<scope>test</scope>
7975
</dependency>
8076
<dependency>

0 commit comments

Comments
 (0)