From 84d0e8acd8ab8ecfcfa55a6d0bf17331ecb988d5 Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Tue, 11 Oct 2016 12:18:39 -0700 Subject: [PATCH] Fix EndpointHandlerMappingTests path references Fix the TestEndpoint constructor to use an ID parameter rather than path. --- .../mvc/EndpointHandlerMappingTests.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java index 8e162f97f4d..77c8dc1336e 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/EndpointHandlerMappingTests.java @@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class EndpointHandlerMappingTests { private final StaticApplicationContext context = new StaticApplicationContext(); + private Method method; @Before @@ -50,8 +51,8 @@ public class EndpointHandlerMappingTests { @Test public void withoutPrefix() throws Exception { - TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); - TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); + TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("a")); + TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("b")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); @@ -65,8 +66,8 @@ public class EndpointHandlerMappingTests { @Test public void withPrefix() throws Exception { - TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); - TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); + TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("a")); + TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("b")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpointA, endpointB)); mapping.setApplicationContext(this.context); @@ -81,7 +82,7 @@ public class EndpointHandlerMappingTests { @Test(expected = HttpRequestMethodNotSupportedException.class) public void onlyGetHttpMethodForNonActionEndpoints() throws Exception { - TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); + TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpoint)); mapping.setApplicationContext(this.context); @@ -92,7 +93,7 @@ public class EndpointHandlerMappingTests { @Test public void postHttpMethodForActionEndpoints() throws Exception { - TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); + TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpoint)); mapping.setApplicationContext(this.context); @@ -102,7 +103,7 @@ public class EndpointHandlerMappingTests { @Test(expected = HttpRequestMethodNotSupportedException.class) public void onlyPostHttpMethodForActionEndpoints() throws Exception { - TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); + TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpoint)); mapping.setApplicationContext(this.context); @@ -113,7 +114,7 @@ public class EndpointHandlerMappingTests { @Test public void disabled() throws Exception { - TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); + TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpoint)); mapping.setDisabled(true); @@ -124,8 +125,8 @@ public class EndpointHandlerMappingTests { @Test public void duplicatePath() throws Exception { - TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); - TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("/a")); + TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a")); + TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("a")); EndpointHandlerMapping mapping = new EndpointHandlerMapping( Arrays.asList(endpoint, other)); mapping.setDisabled(true); @@ -141,8 +142,8 @@ public class EndpointHandlerMappingTests { private static class TestEndpoint extends AbstractEndpoint { - TestEndpoint(String path) { - super(path); + TestEndpoint(String id) { + super(id); } @Override