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
3bd940ba
Commit
3bd940ba
authored
Jan 25, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Add more WebEndpointAutoConfiguration tests"
Closes gh-11754
parent
d8527a97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
31 deletions
+26
-31
WebEndpointAutoConfigurationTests.java
...igure/endpoint/web/WebEndpointAutoConfigurationTests.java
+26
-31
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfigurationTests.java
View file @
3bd940ba
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -34,57 +34,52 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -34,57 +34,52 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link WebEndpointAutoConfiguration}.
* Tests for {@link WebEndpointAutoConfiguration}.
*
*
* @author Andy Wilkinson
* @author Andy Wilkinson
* @author Yunkun Huang
*/
*/
public
class
WebEndpointAutoConfigurationTests
{
public
class
WebEndpointAutoConfigurationTests
{
private
WebApplicationContextRunner
contextRunner
=
new
WebApplicationContextRunner
()
.
withConfiguration
(
AutoConfigurations
.
of
(
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
));
@Test
@Test
public
void
webApplicationConfiguresEndpointMediaTypes
()
{
public
void
webApplicationConfiguresEndpointMediaTypes
()
{
new
WebApplicationContextRunner
().
withConfiguration
(
AutoConfigurations
this
.
contextRunner
.
run
((
context
)
->
{
.
of
(
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
))
EndpointMediaTypes
endpointMediaTypes
=
context
.
run
((
context
)
->
{
.
getBean
(
EndpointMediaTypes
.
class
);
EndpointMediaTypes
endpointMediaTypes
=
context
assertThat
(
endpointMediaTypes
.
getConsumed
())
.
getBean
(
EndpointMediaTypes
.
class
);
.
containsExactly
(
ActuatorMediaType
.
V2_JSON
,
"application/json"
);
assertThat
(
endpointMediaTypes
.
getConsumed
()).
containsExactly
(
});
ActuatorMediaType
.
V2_JSON
,
"application/json"
);
});
}
}
@Test
@Test
public
void
webApplicationConfiguresPathMapper
()
{
public
void
webApplicationConfiguresPathMapper
()
{
new
WebApplicationContextRunner
()
this
.
contextRunner
.
withPropertyValues
(
"management.endpoints.web.path-mapping.health=healthcheck"
)
.
withPropertyValues
(
.
withConfiguration
(
AutoConfigurations
.
of
(
EndpointAutoConfiguration
.
class
,
"management.endpoints.web.path-mapping.health=healthcheck"
)
WebEndpointAutoConfiguration
.
class
))
.
run
((
context
)
->
{
.
run
((
context
)
->
{
assertThat
(
context
).
hasSingleBean
(
PathMapper
.
class
);
assertThat
(
context
).
hasSingleBean
(
PathMapper
.
class
);
String
pathMapping
=
context
.
getBean
(
PathMapper
.
class
).
getRootPath
(
"health"
);
String
pathMapping
=
context
.
getBean
(
PathMapper
.
class
)
.
getRootPath
(
"health"
);
assertThat
(
pathMapping
).
isEqualTo
(
"healthcheck"
);
assertThat
(
pathMapping
).
isEqualTo
(
"healthcheck"
);
});
});
}
}
@Test
@Test
public
void
webApplicationConfiguresEndpointDiscoverer
()
{
public
void
webApplicationConfiguresEndpointDiscoverer
()
{
new
WebApplicationContextRunner
()
this
.
contextRunner
.
run
((
context
)
->
{
.
withConfiguration
(
AutoConfigurations
.
of
(
EndpointAutoConfiguration
.
class
,
assertThat
(
context
).
hasSingleBean
(
ControllerEndpointDiscoverer
.
class
);
WebEndpointAutoConfiguration
.
class
))
assertThat
(
context
).
hasSingleBean
(
WebEndpointDiscoverer
.
class
);
.
run
((
context
)
->
{
});
assertThat
(
context
).
hasSingleBean
(
ControllerEndpointDiscoverer
.
class
);
assertThat
(
context
).
hasSingleBean
(
WebEndpointDiscoverer
.
class
);
});
}
}
@Test
@Test
public
void
webApplicationConfiguresExposeExcludePropertyEndpointFilter
()
{
public
void
webApplicationConfiguresExposeExcludePropertyEndpointFilter
()
{
new
WebApplicationContextRunner
()
this
.
contextRunner
.
run
((
context
)
->
{
.
withConfiguration
(
AutoConfigurations
.
of
(
EndpointAutoConfiguration
.
class
,
assertThat
(
context
).
getBeans
(
ExposeExcludePropertyEndpointFilter
.
class
)
WebEndpointAutoConfiguration
.
class
))
.
containsKeys
(
"webIncludeExcludePropertyEndpointFilter"
,
.
run
((
context
)
->
{
"controllerIncludeExcludePropertyEndpointFilter"
);
assertThat
(
context
).
getBeans
(
ExposeExcludePropertyEndpointFilter
.
class
).
containsKeys
(
});
"webIncludeExcludePropertyEndpointFilter"
,
"controllerIncludeExcludePropertyEndpointFilter"
);
});
}
}
}
}
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