Search in sources :

Example 6 with ApiError

use of com.nike.backstopper.apierror.ApiError in project riposte by Nike-Inc.

the class ErrorResponseBodyImplTest method verifyAdapter.

private void verifyAdapter(ErrorResponseBodyImpl adapter, String expectedErrorId, List<ApiError> expectedErrors) {
    assertThat(adapter.error_id, is(expectedErrorId));
    assertThat(adapter.errorId(), is(expectedErrorId));
    assertThat(adapter.errors.size(), is(expectedErrors.size()));
    for (int i = 0; i < expectedErrors.size(); i++) {
        ApiError apiError = expectedErrors.get(i);
        DefaultErrorDTO errorView = adapter.errors.get(i);
        assertThat(errorView.code, is(apiError.getErrorCode()));
        assertThat(errorView.message, is(apiError.getMessage()));
    }
}
Also used : DefaultErrorDTO(com.nike.backstopper.model.DefaultErrorDTO) ApiError(com.nike.backstopper.apierror.ApiError)

Example 7 with ApiError

use of com.nike.backstopper.apierror.ApiError in project riposte by Nike-Inc.

the class ErrorResponseBodyImplTest method errorResponseViewWrapperConstructorWorks.

@Test
public void errorResponseViewWrapperConstructorWorks() {
    String errorUuid = UUID.randomUUID().toString();
    List<ApiError> errorsList = Arrays.asList(BarebonesCoreApiErrorForTesting.NO_ACCEPTABLE_REPRESENTATION, BarebonesCoreApiErrorForTesting.UNSUPPORTED_MEDIA_TYPE);
    DefaultErrorContractDTO errorContract = new DefaultErrorContractDTO(errorUuid, errorsList);
    ErrorResponseBodyImpl adapter = new ErrorResponseBodyImpl(errorContract);
    verifyAdapter(adapter, errorUuid, errorsList);
}
Also used : DefaultErrorContractDTO(com.nike.backstopper.model.DefaultErrorContractDTO) ApiError(com.nike.backstopper.apierror.ApiError) Test(org.junit.Test)

Aggregations

ApiError (com.nike.backstopper.apierror.ApiError)7 Test (org.junit.Test)4 ApiErrorBase (com.nike.backstopper.apierror.ApiErrorBase)2 ApiErrorWithMetadata (com.nike.backstopper.apierror.ApiErrorWithMetadata)2 DefaultErrorContractDTO (com.nike.backstopper.model.DefaultErrorContractDTO)2 DefaultErrorDTO (com.nike.backstopper.model.DefaultErrorDTO)2 Pair (com.nike.internal.util.Pair)2 ProjectApiErrors (com.nike.backstopper.apierror.projectspecificinfo.ProjectApiErrors)1 SampleCoreApiError (com.nike.backstopper.apierror.sample.SampleCoreApiError)1 CircuitBreakerException (com.nike.fastbreak.exception.CircuitBreakerException)1 DownstreamChannelClosedUnexpectedlyException (com.nike.riposte.server.error.exception.DownstreamChannelClosedUnexpectedlyException)1 DownstreamIdleChannelTimeoutException (com.nike.riposte.server.error.exception.DownstreamIdleChannelTimeoutException)1 Forbidden403Exception (com.nike.riposte.server.error.exception.Forbidden403Exception)1 HostnameResolutionException (com.nike.riposte.server.error.exception.HostnameResolutionException)1 IncompleteHttpCallTimeoutException (com.nike.riposte.server.error.exception.IncompleteHttpCallTimeoutException)1 InvalidCharsetInContentTypeHeaderException (com.nike.riposte.server.error.exception.InvalidCharsetInContentTypeHeaderException)1 InvalidHttpRequestException (com.nike.riposte.server.error.exception.InvalidHttpRequestException)1 MethodNotAllowed405Exception (com.nike.riposte.server.error.exception.MethodNotAllowed405Exception)1 MultipleMatchingEndpointsException (com.nike.riposte.server.error.exception.MultipleMatchingEndpointsException)1 NativeIoExceptionWrapper (com.nike.riposte.server.error.exception.NativeIoExceptionWrapper)1