use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class SamlProxyDuplicateRequestExceptionMapperTest method shouldCreateAuditedErrorResponseForDuplicateRequestIdError.
@Test
public void shouldCreateAuditedErrorResponseForDuplicateRequestIdError() {
SamlDuplicateRequestIdException exception = new SamlDuplicateRequestIdException("error", new RuntimeException(), Level.DEBUG);
SessionId sessionId = SessionId.createNewSessionId();
when(httpServletRequest.getParameter(Urls.SharedUrls.SESSION_ID_PARAM)).thenReturn(sessionId.getSessionId());
Response response = exceptionMapper.handleException(exception);
ErrorStatusDto responseEntity = (ErrorStatusDto) response.getEntity();
assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
assertThat(responseEntity.isAudited()).isTrue();
assertThat(responseEntity.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML_DUPLICATE_REQUEST_ID);
verify(eventSinkMessageSender).audit(eq(exception), any(UUID.class), eq(sessionId));
}
Aggregations