use of uk.gov.ida.hub.samlsoapproxy.domain.MatchingServiceHealthCheckResponseDto in project verify-hub by alphagov.
the class MatchingServiceHealthCheckerTest method handle_shouldReturnFailureWithMessageFromMatchingServiceThatCannotBeParsed.
@Test
public void handle_shouldReturnFailureWithMessageFromMatchingServiceThatCannotBeParsed() throws Exception {
MatchingServiceConfigEntityDataDto matchingServiceConfigEntityDataDto = aMatchingServiceConfigEntityDataDto().build();
when(samlEngineProxy.generateHealthcheckAttributeQuery(any())).thenReturn(new SamlMessageDto("samSamSaml"));
when(matchingServiceHealthCheckClient.sendHealthCheckRequest(any(), eq(matchingServiceConfigEntityDataDto.getUri()))).thenReturn(new MatchingServiceHealthCheckResponseDto(Optional.of("<saml/>"), Optional.<String>absent()));
when(samlEngineProxy.translateHealthcheckMatchingServiceResponse(any())).thenThrow(ApplicationException.createAuditedException(ExceptionType.INVALID_SAML, UUID.randomUUID()));
MatchingServiceHealthCheckResult result = matchingServiceHealthChecker.performHealthCheck(matchingServiceConfigEntityDataDto);
assertThat(result.isHealthy()).isEqualTo(false);
assertThat(result.getDetails().getDetails()).isEqualTo("Unable to convert saml request to XML element: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.");
}
Aggregations