mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Fix EndpointHandlerMappingTests path references
Fix the TestEndpoint constructor to use an ID parameter rather than path.
This commit is contained in:
parent
2d995661f4
commit
84d0e8acd8
@ -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<Object> {
|
||||
|
||||
TestEndpoint(String path) {
|
||||
super(path);
|
||||
TestEndpoint(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user