Search in sources :

Example 1 with NoMatchState

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

the class NoMatchStateBuilderTest method withRelayState.

@Test
public void withRelayState() throws Exception {
    NoMatchState noMatchState = NoMatchStateBuilder.aNoMatchState().withRelayState(Optional.of(RELAY_STATE)).build();
    assertThat(noMatchState.getRelayState()).isEqualTo(Optional.of(RELAY_STATE));
}
Also used : NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) Test(org.junit.Test)

Example 2 with NoMatchState

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

the class NoMatchStateBuilderTest method withIdentityProviderEntityId.

@Test
public void withIdentityProviderEntityId() {
    NoMatchState noMatchState = NoMatchStateBuilder.aNoMatchState().withIdentityProviderEntityId(IDENTITY_PROVIDER_ENTITY_ID).build();
    assertThat(noMatchState.getIdentityProviderEntityId()).isEqualTo(IDENTITY_PROVIDER_ENTITY_ID);
}
Also used : NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) Test(org.junit.Test)

Example 3 with NoMatchState

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

the class NoMatchStateBuilderTest method build.

@Test
public void build() {
    NoMatchState noMatchState = NoMatchStateBuilder.aNoMatchState().build();
    assertThat(noMatchState.getRequestId()).isEqualTo("request ID");
    assertThat(noMatchState.getIdentityProviderEntityId()).isEqualTo("idp entity id");
    assertThat(noMatchState.getRequestIssuerEntityId()).isEqualTo("requestIssuerId");
    assertThat(noMatchState.getSessionExpiryTimestamp()).isEqualTo(DateTime.now().plusMinutes(10));
    assertThat(noMatchState.getAssertionConsumerServiceUri()).isEqualTo(URI.create("/someUri"));
    assertThat(noMatchState.getRelayState()).isEqualTo(Optional.absent());
    assertThat(noMatchState.getSessionId()).isEqualTo(new SessionId("sessionId"));
    assertThat(noMatchState.getTransactionSupportsEidas()).isEqualTo(false);
}
Also used : NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) SessionId(uk.gov.ida.hub.policy.domain.SessionId) Test(org.junit.Test)

Example 4 with NoMatchState

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

the class Cycle0And1MatchRequestSentStateControllerTest method responseProcessingDetails_shouldReturnNoMatchStatus_noMatchResponseSentFromMatchingService.

@Test
public void responseProcessingDetails_shouldReturnNoMatchStatus_noMatchResponseSentFromMatchingService() {
    ArgumentCaptor<NoMatchState> argumentCaptor = ArgumentCaptor.forClass(NoMatchState.class);
    NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(MATCHING_SERVICE_ENTITY_ID, REQUEST_ID);
    when(transactionsConfigProxy.getMatchingProcess(TRANSACTION_ENTITY_ID)).thenReturn(new MatchingProcess(Optional.absent()));
    when(transactionsConfigProxy.getUserAccountCreationAttributes(TRANSACTION_ENTITY_ID)).thenReturn(emptyList());
    controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
    verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
    NoMatchStateController noMatchStateController = new NoMatchStateController(argumentCaptor.getValue(), responseFromHubFactory);
    final ResponseProcessingDetails responseProcessingDetails = noMatchStateController.getResponseProcessingDetails();
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_NO_MATCH_RESPONSE_TO_TRANSACTION);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(state.getSessionId());
}
Also used : NoMatchFromMatchingService(uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService) MatchingProcess(uk.gov.ida.hub.policy.domain.MatchingProcess) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.Test)

Example 5 with NoMatchState

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

the class Cycle3MatchRequestSentStateControllerTest method statusShouldSendNoMatchResponseToTransaction_whenNoMatchResponseSentFromMatchingServiceCycle3Match.

@Test
public void statusShouldSendNoMatchResponseToTransaction_whenNoMatchResponseSentFromMatchingServiceCycle3Match() {
    final String requestId = "requestId";
    final SessionId sessionId = SessionId.createNewSessionId();
    Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
    Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
    ArgumentCaptor<NoMatchState> argumentCaptor = ArgumentCaptor.forClass(NoMatchState.class);
    NoMatchFromMatchingService noMatchFromMatchingService = new NoMatchFromMatchingService(matchingServiceEntityId, requestId);
    controller.handleNoMatchResponseFromMatchingService(noMatchFromMatchingService);
    verify(stateTransitionAction, times(1)).transitionTo(argumentCaptor.capture());
    NoMatchStateController noMatchStateController = new NoMatchStateController(argumentCaptor.getValue(), responseFromHubFactory);
    ResponseProcessingDetails responseProcessingDetails = noMatchStateController.getResponseProcessingDetails();
    assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.SEND_NO_MATCH_RESPONSE_TO_TRANSACTION);
    assertThat(responseProcessingDetails.getSessionId()).isEqualTo(sessionId);
}
Also used : NoMatchFromMatchingService(uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService) Cycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState) Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState(uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState) Matchers.anyString(org.mockito.Matchers.anyString) SessionId(uk.gov.ida.hub.policy.domain.SessionId) NoMatchState(uk.gov.ida.hub.policy.domain.state.NoMatchState) ResponseProcessingDetails(uk.gov.ida.hub.policy.domain.ResponseProcessingDetails) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 NoMatchState (uk.gov.ida.hub.policy.domain.state.NoMatchState)7 MatchingProcess (uk.gov.ida.hub.policy.domain.MatchingProcess)2 NoMatchFromMatchingService (uk.gov.ida.hub.policy.domain.NoMatchFromMatchingService)2 ResponseProcessingDetails (uk.gov.ida.hub.policy.domain.ResponseProcessingDetails)2 SessionId (uk.gov.ida.hub.policy.domain.SessionId)2 Matchers.anyString (org.mockito.Matchers.anyString)1 Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState)1 EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.builder.state.EidasCycle0And1MatchRequestSentStateBuilder.anEidasCycle0And1MatchRequestSentState)1 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)1 State (uk.gov.ida.hub.policy.domain.State)1 StateController (uk.gov.ida.hub.policy.domain.StateController)1 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)1 EidasAwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.EidasAwaitingCycle3DataState)1 EidasCycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState)1 EidasSuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.EidasSuccessfulMatchState)1