Polish
See gh-11811
This commit is contained in:
committed by
Stephane Nicoll
parent
5332bcbe28
commit
914bdb393f
@@ -29,8 +29,8 @@ import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link ServletContextInitializer} to register {@link ExposableServletEndpoint} servlet
|
||||
* endpoints.
|
||||
* {@link ServletContextInitializer} to register {@link ExposableServletEndpoint servlet
|
||||
* endpoints}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 2.0.0
|
||||
|
||||
@@ -46,7 +46,7 @@ class DiscoveredServletEndpoint extends AbstractDiscoveredEndpoint<Operation>
|
||||
() -> "ServletEndpoint bean " + beanType + " must be a supplier");
|
||||
Object supplied = ((Supplier<?>) endpointBean).get();
|
||||
Assert.state(supplied != null,
|
||||
"ServletEndpoint bean " + beanType + " must not supply null");
|
||||
() -> "ServletEndpoint bean " + beanType + " must not supply null");
|
||||
Assert.state(supplied instanceof EndpointServlet, () -> "ServletEndpoint bean "
|
||||
+ beanType + " must supply an EndpointServlet");
|
||||
this.endpointServlet = (EndpointServlet) supplied;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ServletEndpointDiscoverer
|
||||
private final PathMapper endpointPathMapper;
|
||||
|
||||
/**
|
||||
* Create a new {@link ServletEndpointFilter} instance.
|
||||
* Create a new {@link ServletEndpointDiscoverer} instance.
|
||||
* @param applicationContext the source application context
|
||||
* @param endpointPathMapper the endpoint path mapper
|
||||
* @param filters filters to apply
|
||||
|
||||
@@ -83,7 +83,7 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
||||
* Create a new {@link WebMvcMetricsFilter} instance.
|
||||
* @param context the source application context
|
||||
* @param registry the meter registry
|
||||
* @param tagsProvider the tags provier
|
||||
* @param tagsProvider the tags provider
|
||||
* @param metricName the metric name
|
||||
* @param autoTimeRequests if requests should be automatically timed
|
||||
*/
|
||||
|
||||
@@ -76,14 +76,14 @@ public class EndpointServletTests {
|
||||
public void withInitParameterNullName() {
|
||||
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
endpointServlet.withInitParameters(Collections.singletonMap(null, "value"));
|
||||
endpointServlet.withInitParameter(null, "value");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInitParameterEmptyName() {
|
||||
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
endpointServlet.withInitParameters(Collections.singletonMap(" ", "value"));
|
||||
endpointServlet.withInitParameter(" ", "value");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -102,6 +102,20 @@ public class EndpointServletTests {
|
||||
entry("a", "b1"), entry("c", "d"), entry("e", "f"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInitParametersNullName() {
|
||||
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
endpointServlet.withInitParameters(Collections.singletonMap(null, "value"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInitParametersEmptyName() {
|
||||
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
endpointServlet.withInitParameters(Collections.singletonMap(" ", "value"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withInitParametersShouldCreateNewInstance() {
|
||||
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
|
||||
|
||||
Reference in New Issue
Block a user