31
31
import static org .assertj .core .api .Assertions .assertThat ;
32
32
33
33
/**
34
+ * Tests for {@link JerseyWebEndpointManagementContextConfiguration}.
35
+ *
34
36
* @author Michael Simons
35
37
*/
36
38
public class JerseyWebEndpointManagementContextConfigurationTests {
37
39
38
40
private final WebApplicationContextRunner runner = new WebApplicationContextRunner ()
39
- .withConfiguration (AutoConfigurations .of (WebEndpointAutoConfiguration .class , JerseyWebEndpointManagementContextConfiguration .class ));
41
+ .withConfiguration (AutoConfigurations .of (WebEndpointAutoConfiguration .class ,
42
+ JerseyWebEndpointManagementContextConfiguration .class ));
40
43
41
44
@ Test
42
- public void contextShouldContainSingleResourceConfig () {
43
- this .runner
44
- .withUserConfiguration (WebEndpointsSupplierConfig .class )
45
- .run (context -> assertThat (context ).hasSingleBean (ResourceConfig .class ));
45
+ public void resourceConfigIsAutoConfiguredWhenNeeded () {
46
+ this .runner .withUserConfiguration (WebEndpointsSupplierConfig .class ).run (
47
+ (context ) -> assertThat (context ).hasSingleBean (ResourceConfig .class ));
46
48
}
47
49
48
50
@ Test
49
- public void contextWhenResourceConfigExistsShouldContainSingleResourceConfig () {
50
- this .runner
51
- .withUserConfiguration (
52
- WebEndpointsSupplierConfig .class ,
53
- ConfigWithResourceConfig .class )
54
- .run (context -> {
55
- assertThat (context ).hasSingleBean (ResourceConfig .class );
56
- assertThat (context ).hasBean ("customResourceConfig" );
57
- });
51
+ public void existingResourceConfigIsUsedWhenAvailable () {
52
+ this .runner .withUserConfiguration (WebEndpointsSupplierConfig .class ,
53
+ ConfigWithResourceConfig .class ).run ((context ) -> {
54
+ assertThat (context ).hasSingleBean (ResourceConfig .class );
55
+ assertThat (context ).hasBean ("customResourceConfig" );
56
+ });
58
57
}
59
58
60
59
@ Configuration
@@ -64,6 +63,7 @@ static class WebEndpointsSupplierConfig {
64
63
public WebEndpointsSupplier webEndpointsSupplier () {
65
64
return () -> Collections .emptyList ();
66
65
}
66
+
67
67
}
68
68
69
69
@ Configuration
@@ -73,5 +73,7 @@ static class ConfigWithResourceConfig {
73
73
public ResourceConfig customResourceConfig () {
74
74
return new ResourceConfig ();
75
75
}
76
+
76
77
}
78
+
77
79
}
0 commit comments