@Test public void should_honor_constructor_params() { //given Endpoint<?> endpoint1 = new EndpointOne(); Endpoint<?> endpoint2 = new EndpointTwo(); List<Endpoint<?>> endpointList = Arrays.asList(endpoint1, endpoint2); String requestPath = UUID.randomUUID().toString(); String requestMethod = UUID.randomUUID().toString(); String message = UUID.randomUUID().toString(); //when MultipleMatchingEndpointsException ex = new MultipleMatchingEndpointsException(message, endpointList, requestPath, requestMethod); //then assertThat(ex.getMessage(), is(message)); assertThat(ex.matchingEndpointsDetails, is(Arrays.asList(EndpointOne.class.getName(), EndpointTwo.class.getName()))); assertThat(ex.requestPath, is(requestPath)); assertThat(ex.requestMethod, is(requestMethod)); }
throw new MultipleMatchingEndpointsException( "Found multiple endpoints that matched the incoming request's path and HTTP method. This is not " + "allowed - your endpoints must be structured so that only one endpoint can match any given request",
throw new MultipleMatchingEndpointsException( "Found multiple endpoints that matched the incoming request's path and HTTP method. This is not " + "allowed - your endpoints must be structured so that only one endpoint can match any given request",
@Test public void shouldHandleMultipleMatchingEndpointsException() { verifyExceptionHandled(new MultipleMatchingEndpointsException("intentional boom", Collections.emptyList(), null, null), singletonError(testProjectApiErrors.getGenericServiceError())); }