mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Fix tests
This commit is contained in:
parent
decaacddce
commit
02a1c43587
@ -24,6 +24,7 @@ import org.junit.Test;
|
||||
import org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar;
|
||||
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.JerseyApplicationPath;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@ -60,7 +61,7 @@ public class ServletEndpointManagementContextConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void servletPathShouldNotAffectJerseyConfiguration() {
|
||||
public void contextWhenJerseyShouldContainServletEndpointRegistrar() {
|
||||
FilteredClassLoader classLoader = new FilteredClassLoader(
|
||||
DispatcherServlet.class);
|
||||
this.contextRunner.withClassLoader(classLoader).run((context) -> {
|
||||
@ -68,7 +69,7 @@ public class ServletEndpointManagementContextConfigurationTests {
|
||||
ServletEndpointRegistrar bean = context
|
||||
.getBean(ServletEndpointRegistrar.class);
|
||||
String basePath = (String) ReflectionTestUtils.getField(bean, "basePath");
|
||||
assertThat(basePath).isEqualTo("/actuator");
|
||||
assertThat(basePath).isEqualTo("/jersey/actuator");
|
||||
});
|
||||
}
|
||||
|
||||
@ -94,6 +95,11 @@ public class ServletEndpointManagementContextConfigurationTests {
|
||||
return () -> "/test";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JerseyApplicationPath jerseyApplicationPath() {
|
||||
return () -> "/jersey";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user