use of com.nike.backstopper.apierror.ApiErrorBase in project riposte by Nike-Inc.
the class BackstopperRiposteFrameworkErrorHandlerListenerTest method constructor_sets_projectApiErrors_to_passed_in_arg.
@Test
public void constructor_sets_projectApiErrors_to_passed_in_arg() {
// given
ProjectApiErrors projectErrorsMock = mock(ProjectApiErrors.class);
ApiError temporaryError = new ApiErrorBase("temp_error_for_test", 42, "temporary error", 503);
doReturn(temporaryError).when(projectErrorsMock).getTemporaryServiceProblemApiError();
// when
BackstopperRiposteFrameworkErrorHandlerListener impl = new BackstopperRiposteFrameworkErrorHandlerListener(projectErrorsMock);
// then
assertThat(impl.projectApiErrors).isSameAs(projectErrorsMock);
}
use of com.nike.backstopper.apierror.ApiErrorBase in project riposte by Nike-Inc.
the class VerifyMiscellaneousFunctionalityComponentTest method verify_proxy_router_response_modification_works_as_expected.
@Test
public void verify_proxy_router_response_modification_works_as_expected() throws IOException, InterruptedException {
ExtractableResponse response = given().baseUri("http://127.0.0.1").port(serverConfig.endpointsPort()).basePath(ProxyRouterResponseModificationEndpoint.MATCHING_PATH).log().all().when().get().then().log().headers().extract();
ApiError unmodifiedError = EmptyMetadataErrorThrower.ERROR_NO_METADATA;
assertThat(response.statusCode()).isEqualTo(ProxyRouterResponseModificationEndpoint.MODIFIED_HTTP_STATUS_RESPONSE_CODE);
assertThat(response.header(ProxyRouterResponseModificationEndpoint.ORIG_HTTP_STATUS_CODE_RESPONSE_HEADER_KEY)).isEqualTo(String.valueOf(unmodifiedError.getHttpStatusCode()));
ApiError expectedModifiedError = new ApiErrorBase(unmodifiedError.getName(), unmodifiedError.getErrorCode(), unmodifiedError.getMessage(), ProxyRouterResponseModificationEndpoint.MODIFIED_HTTP_STATUS_RESPONSE_CODE);
verifyErrorReceived(response, expectedModifiedError);
assertThat(response.asString()).doesNotContain("metadata");
}
Aggregations