use of uk.gov.ida.hub.policy.domain.EventSinkHubEvent in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method cycle3SuccessfulMatchResponseFromMatchingService_shouldLogCycle3MatchEventToEventSink.
@Test
public void cycle3SuccessfulMatchResponseFromMatchingService_shouldLogCycle3MatchEventToEventSink() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, mock(StateTransitionAction.class), policyConfiguration, mock(LevelOfAssuranceValidator.class), null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
ArgumentCaptor<EventSinkHubEvent> argumentCaptor = ArgumentCaptor.forClass(EventSinkHubEvent.class);
MatchFromMatchingService matchFromMatchingService = new MatchFromMatchingService(matchingServiceEntityId, requestId, "assertionBlob", Optional.of(LevelOfAssurance.LEVEL_1));
controller.handleMatchResponseFromMatchingService(matchFromMatchingService);
verify(eventSinkProxy, times(1)).logHubEvent(argumentCaptor.capture());
assertThat(argumentCaptor.getValue().getEventType()).isEqualTo(EventSinkHubEventConstants.EventTypes.SESSION_EVENT);
assertThat(argumentCaptor.getValue().getDetails().get(EventDetailsKey.session_event_type)).isEqualTo(CYCLE3_MATCH);
assertThat(argumentCaptor.getValue().getSessionId()).isEqualTo(sessionId.getSessionId());
assertThat(argumentCaptor.getValue().getDetails().get(EventDetailsKey.request_id)).isEqualTo(requestId);
assertThat(argumentCaptor.getValue().getOriginatingService()).isEqualTo(serviceInfo.getName());
}
Aggregations