Search in sources :

Example 1 with ResponseFromMatchingService

use of uk.gov.ida.hub.policy.domain.ResponseFromMatchingService in project verify-hub by alphagov.

the class UserAccountCreationRequestSentStateControllerTest method getNextState_shouldThrowStateProcessingValidationExceptionIfResponseIsNotFromTheExpectedMatchingService.

@Test
public void getNextState_shouldThrowStateProcessingValidationExceptionIfResponseIsNotFromTheExpectedMatchingService() {
    UserAccountCreationRequestSentState state = aUserAccountCreationRequestSentState().build();
    UserAccountCreationRequestSentStateController controller = new UserAccountCreationRequestSentStateController(state, null, null, null, null, null, null);
    ResponseFromMatchingService responseFromMatchingService = new UserAccountCreatedFromMatchingService("issuer-id", "", "", Optional.absent());
    try {
        controller.validateResponse(responseFromMatchingService);
        fail("fail");
    } catch (StateProcessingValidationException e) {
        assertThat(e.getMessage()).isEqualTo("Response to request ID [" + state.getRequestId() + "] came from [issuer-id] and was expected to come from [matchingServiceEntityId]");
    }
}
Also used : ResponseFromMatchingService(uk.gov.ida.hub.policy.domain.ResponseFromMatchingService) UserAccountCreatedFromMatchingService(uk.gov.ida.hub.policy.domain.UserAccountCreatedFromMatchingService) StateProcessingValidationException(uk.gov.ida.hub.policy.domain.exception.StateProcessingValidationException) UserAccountCreationRequestSentStateBuilder.aUserAccountCreationRequestSentState(uk.gov.ida.hub.policy.builder.state.UserAccountCreationRequestSentStateBuilder.aUserAccountCreationRequestSentState) UserAccountCreationRequestSentState(uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 UserAccountCreationRequestSentStateBuilder.aUserAccountCreationRequestSentState (uk.gov.ida.hub.policy.builder.state.UserAccountCreationRequestSentStateBuilder.aUserAccountCreationRequestSentState)1 ResponseFromMatchingService (uk.gov.ida.hub.policy.domain.ResponseFromMatchingService)1 UserAccountCreatedFromMatchingService (uk.gov.ida.hub.policy.domain.UserAccountCreatedFromMatchingService)1 StateProcessingValidationException (uk.gov.ida.hub.policy.domain.exception.StateProcessingValidationException)1 UserAccountCreationRequestSentState (uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState)1