@Test
public void handleRequest_imageCreationNotYetStabilized_failed_imageCreationFailed() {

    final GetImageResponse getImageResponse = GetImageResponse.builder()
            .image(Image.builder()
                    .arn(generateImageForTest().arn())
                    .state((ImageState.builder()
                            .status(ImageStatus.FAILED.toString())
                            .build()))
                    .build())
            .build();
    final ResourceHandlerRequest<ResourceModel> request = ResourceHandlerRequest.<ResourceModel>builder()
            .desiredResourceState(model)
            .build();
    final CallbackContext inputContext = CallbackContext.builder()
            .imageCreationInvoked(true)
            .build();
    final CallbackContext outputContext = CallbackContext.builder()
            .imageCreationInvoked(true)
            .build();
    doReturn(getImageResponse)
            .when(proxy)
            .injectCredentialsAndInvokeV2(any(GetImageRequest.class), any());
    final ProgressEvent<ResourceModel, CallbackContext> response
            = handler.handleRequest(proxy, request, inputContext, logger);
    assertThat(response).isNotNull();
    assertThat(response.getStatus()).isEqualTo(OperationStatus.FAILED);
    assertThat(response.getCallbackContext()).isNull();
    assertThat(response.getCallbackDelaySeconds()).isEqualTo(0);
    assertThat(response.getResourceModels()).isNull();
    assertThat(response.getMessage()).isEqualTo("Error occurred during operation 'Image Creation Failed.'.");
    assertThat(response.getErrorCode()).isEqualTo(HandlerErrorCode.GeneralServiceException);
}