Search in sources :

Example 1 with ProjectApiErrors

use of com.nike.backstopper.apierror.projectspecificinfo.ProjectApiErrors 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);
}
Also used : ApiErrorBase(com.nike.backstopper.apierror.ApiErrorBase) ApiError(com.nike.backstopper.apierror.ApiError) ProjectApiErrors(com.nike.backstopper.apierror.projectspecificinfo.ProjectApiErrors) Test(org.junit.Test)

Example 2 with ProjectApiErrors

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

the class RiposteApiExceptionHandlerTest method constructorWorksIfPassedValidValues.

@Test
public void constructorWorksIfPassedValidValues() {
    // when
    RiposteApiExceptionHandler myAdapter = new RiposteApiExceptionHandler(projectApiErrors, validListenerList, utils);
    // then
    List<ApiExceptionHandlerListener> actualListeners = (List<ApiExceptionHandlerListener>) Whitebox.getInternalState(myAdapter, "apiExceptionHandlerListenerList");
    ProjectApiErrors actualProjectApiErrors = (ProjectApiErrors) Whitebox.getInternalState(myAdapter, "projectApiErrors");
    ApiExceptionHandlerUtils actualUtils = (ApiExceptionHandlerUtils) Whitebox.getInternalState(myAdapter, "utils");
    assertThat(actualListeners, is(validListenerList));
    assertThat(actualProjectApiErrors, is(projectApiErrors));
    assertThat(actualUtils, is(utils));
}
Also used : List(java.util.List) ProjectApiErrors(com.nike.backstopper.apierror.projectspecificinfo.ProjectApiErrors) ApiExceptionHandlerListener(com.nike.backstopper.handler.listener.ApiExceptionHandlerListener) GenericApiExceptionHandlerListener(com.nike.backstopper.handler.listener.impl.GenericApiExceptionHandlerListener) ApiExceptionHandlerUtils(com.nike.backstopper.handler.ApiExceptionHandlerUtils) Test(org.junit.Test)

Aggregations

ProjectApiErrors (com.nike.backstopper.apierror.projectspecificinfo.ProjectApiErrors)2 Test (org.junit.Test)2 ApiError (com.nike.backstopper.apierror.ApiError)1 ApiErrorBase (com.nike.backstopper.apierror.ApiErrorBase)1 ApiExceptionHandlerUtils (com.nike.backstopper.handler.ApiExceptionHandlerUtils)1 ApiExceptionHandlerListener (com.nike.backstopper.handler.listener.ApiExceptionHandlerListener)1 GenericApiExceptionHandlerListener (com.nike.backstopper.handler.listener.impl.GenericApiExceptionHandlerListener)1 List (java.util.List)1