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
a325b13d
Commit
a325b13d
authored
May 11, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Auto-configure a ResourceConfig for Jersey endpoints if needed"
Closes gh-11948
parent
bb2864ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
JerseyWebEndpointManagementContextConfigurationTests.java
...JerseyWebEndpointManagementContextConfigurationTests.java
+16
-14
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfigurationTests.java
View file @
a325b13d
...
...
@@ -31,30 +31,29 @@ import org.springframework.context.annotation.Configuration;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Tests for {@link JerseyWebEndpointManagementContextConfiguration}.
*
* @author Michael Simons
*/
public
class
JerseyWebEndpointManagementContextConfigurationTests
{
private
final
WebApplicationContextRunner
runner
=
new
WebApplicationContextRunner
()
.
withConfiguration
(
AutoConfigurations
.
of
(
WebEndpointAutoConfiguration
.
class
,
JerseyWebEndpointManagementContextConfiguration
.
class
));
.
withConfiguration
(
AutoConfigurations
.
of
(
WebEndpointAutoConfiguration
.
class
,
JerseyWebEndpointManagementContextConfiguration
.
class
));
@Test
public
void
contextShouldContainSingleResourceConfig
()
{
this
.
runner
.
withUserConfiguration
(
WebEndpointsSupplierConfig
.
class
)
.
run
(
context
->
assertThat
(
context
).
hasSingleBean
(
ResourceConfig
.
class
));
public
void
resourceConfigIsAutoConfiguredWhenNeeded
()
{
this
.
runner
.
withUserConfiguration
(
WebEndpointsSupplierConfig
.
class
).
run
(
(
context
)
->
assertThat
(
context
).
hasSingleBean
(
ResourceConfig
.
class
));
}
@Test
public
void
contextWhenResourceConfigExistsShouldContainSingleResourceConfig
()
{
this
.
runner
.
withUserConfiguration
(
WebEndpointsSupplierConfig
.
class
,
ConfigWithResourceConfig
.
class
)
.
run
(
context
->
{
assertThat
(
context
).
hasSingleBean
(
ResourceConfig
.
class
);
assertThat
(
context
).
hasBean
(
"customResourceConfig"
);
});
public
void
existingResourceConfigIsUsedWhenAvailable
()
{
this
.
runner
.
withUserConfiguration
(
WebEndpointsSupplierConfig
.
class
,
ConfigWithResourceConfig
.
class
).
run
((
context
)
->
{
assertThat
(
context
).
hasSingleBean
(
ResourceConfig
.
class
);
assertThat
(
context
).
hasBean
(
"customResourceConfig"
);
});
}
@Configuration
...
...
@@ -64,6 +63,7 @@ public class JerseyWebEndpointManagementContextConfigurationTests {
public
WebEndpointsSupplier
webEndpointsSupplier
()
{
return
()
->
Collections
.
emptyList
();
}
}
@Configuration
...
...
@@ -73,5 +73,7 @@ public class JerseyWebEndpointManagementContextConfigurationTests {
public
ResourceConfig
customResourceConfig
()
{
return
new
ResourceConfig
();
}
}
}
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