Commit 02a1c435 authored by Madhura Bhave's avatar Madhura Bhave

Fix tests

parent decaacdd
...@@ -24,6 +24,7 @@ import org.junit.Test; ...@@ -24,6 +24,7 @@ import org.junit.Test;
import org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar; import org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier; import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath; 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.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
...@@ -60,7 +61,7 @@ public class ServletEndpointManagementContextConfigurationTests { ...@@ -60,7 +61,7 @@ public class ServletEndpointManagementContextConfigurationTests {
} }
@Test @Test
public void servletPathShouldNotAffectJerseyConfiguration() { public void contextWhenJerseyShouldContainServletEndpointRegistrar() {
FilteredClassLoader classLoader = new FilteredClassLoader( FilteredClassLoader classLoader = new FilteredClassLoader(
DispatcherServlet.class); DispatcherServlet.class);
this.contextRunner.withClassLoader(classLoader).run((context) -> { this.contextRunner.withClassLoader(classLoader).run((context) -> {
...@@ -68,7 +69,7 @@ public class ServletEndpointManagementContextConfigurationTests { ...@@ -68,7 +69,7 @@ public class ServletEndpointManagementContextConfigurationTests {
ServletEndpointRegistrar bean = context ServletEndpointRegistrar bean = context
.getBean(ServletEndpointRegistrar.class); .getBean(ServletEndpointRegistrar.class);
String basePath = (String) ReflectionTestUtils.getField(bean, "basePath"); String basePath = (String) ReflectionTestUtils.getField(bean, "basePath");
assertThat(basePath).isEqualTo("/actuator"); assertThat(basePath).isEqualTo("/jersey/actuator");
}); });
} }
...@@ -94,6 +95,11 @@ public class ServletEndpointManagementContextConfigurationTests { ...@@ -94,6 +95,11 @@ public class ServletEndpointManagementContextConfigurationTests {
return () -> "/test"; return () -> "/test";
} }
@Bean
public JerseyApplicationPath jerseyApplicationPath() {
return () -> "/jersey";
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment