Fix EndpointHandlerMappingTests path references

Fix the TestEndpoint constructor to use an ID parameter rather than
path.
This commit is contained in:
Madhura Bhave 2016-10-11 12:18:39 -07:00 committed by Phillip Webb
parent 2d995661f4
commit 84d0e8acd8
1 changed files with 13 additions and 12 deletions

View File

@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class EndpointHandlerMappingTests { public class EndpointHandlerMappingTests {
private final StaticApplicationContext context = new StaticApplicationContext(); private final StaticApplicationContext context = new StaticApplicationContext();
private Method method; private Method method;
@Before @Before
@ -50,8 +51,8 @@ public class EndpointHandlerMappingTests {
@Test @Test
public void withoutPrefix() throws Exception { public void withoutPrefix() throws Exception {
TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("a"));
TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("b"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpointA, endpointB)); Arrays.asList(endpointA, endpointB));
mapping.setApplicationContext(this.context); mapping.setApplicationContext(this.context);
@ -65,8 +66,8 @@ public class EndpointHandlerMappingTests {
@Test @Test
public void withPrefix() throws Exception { public void withPrefix() throws Exception {
TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpointA = new TestMvcEndpoint(new TestEndpoint("a"));
TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("/b")); TestMvcEndpoint endpointB = new TestMvcEndpoint(new TestEndpoint("b"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpointA, endpointB)); Arrays.asList(endpointA, endpointB));
mapping.setApplicationContext(this.context); mapping.setApplicationContext(this.context);
@ -81,7 +82,7 @@ public class EndpointHandlerMappingTests {
@Test(expected = HttpRequestMethodNotSupportedException.class) @Test(expected = HttpRequestMethodNotSupportedException.class)
public void onlyGetHttpMethodForNonActionEndpoints() throws Exception { public void onlyGetHttpMethodForNonActionEndpoints() throws Exception {
TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpoint)); Arrays.asList(endpoint));
mapping.setApplicationContext(this.context); mapping.setApplicationContext(this.context);
@ -92,7 +93,7 @@ public class EndpointHandlerMappingTests {
@Test @Test
public void postHttpMethodForActionEndpoints() throws Exception { public void postHttpMethodForActionEndpoints() throws Exception {
TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpoint)); Arrays.asList(endpoint));
mapping.setApplicationContext(this.context); mapping.setApplicationContext(this.context);
@ -102,7 +103,7 @@ public class EndpointHandlerMappingTests {
@Test(expected = HttpRequestMethodNotSupportedException.class) @Test(expected = HttpRequestMethodNotSupportedException.class)
public void onlyPostHttpMethodForActionEndpoints() throws Exception { public void onlyPostHttpMethodForActionEndpoints() throws Exception {
TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("/a")); TestActionEndpoint endpoint = new TestActionEndpoint(new TestEndpoint("a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpoint)); Arrays.asList(endpoint));
mapping.setApplicationContext(this.context); mapping.setApplicationContext(this.context);
@ -113,7 +114,7 @@ public class EndpointHandlerMappingTests {
@Test @Test
public void disabled() throws Exception { public void disabled() throws Exception {
TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpoint)); Arrays.asList(endpoint));
mapping.setDisabled(true); mapping.setDisabled(true);
@ -124,8 +125,8 @@ public class EndpointHandlerMappingTests {
@Test @Test
public void duplicatePath() throws Exception { public void duplicatePath() throws Exception {
TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("/a")); TestMvcEndpoint endpoint = new TestMvcEndpoint(new TestEndpoint("a"));
TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("/a")); TestActionEndpoint other = new TestActionEndpoint(new TestEndpoint("a"));
EndpointHandlerMapping mapping = new EndpointHandlerMapping( EndpointHandlerMapping mapping = new EndpointHandlerMapping(
Arrays.asList(endpoint, other)); Arrays.asList(endpoint, other));
mapping.setDisabled(true); mapping.setDisabled(true);
@ -141,8 +142,8 @@ public class EndpointHandlerMappingTests {
private static class TestEndpoint extends AbstractEndpoint<Object> { private static class TestEndpoint extends AbstractEndpoint<Object> {
TestEndpoint(String path) { TestEndpoint(String id) {
super(path); super(id);
} }
@Override @Override