### Question:
MatchingServiceResponseService { public void handleFailure(SessionId sessionId) { getSessionIfItExists(sessionId); logRequesterErrorAndUpdateState(sessionId, "received failure notification from saml-soap-proxy"); } @Inject  MatchingServiceResponseService(SamlEngineProxy samlEngineProxy,
                                          SessionRepository sessionRepository,
                                          HubEventLogger eventLogger); void handleFailure(SessionId sessionId); void handleSuccessResponse(SessionId sessionId, SamlResponseDto samlResponse);  }### Answer:
@Test(expected = SessionNotFoundException.class) public void handle_shouldThrowExceptionIfSessionDoesNotExistInMSResponseFailureCase() { when(sessionRepository.sessionExists(sessionId)).thenReturn(false); matchingServiceResponseService.handleFailure(sessionId); }
@Test public void handle_shouldLogToEventSinkAndUpdateStateWhenHandlingError() { matchingServiceResponseService.handleFailure(sessionId); verify(waitingForMatchingServiceResponseStateController, times(1)).handleRequestFailure(); verify(eventLogger).logErrorEvent(format("received failure notification from saml-soap-proxy for session {0}", sessionId), sessionId); }