@Test public void shouldPlayWelcomeMessagePrompts() { AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2)); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); Node destinationNode = adherenceSummaryTransition.getDestinationNode("", flowSession); assertThat(destinationNode.getPrompts(), hasItems(welcomeMessagePrompts(whpIvrMessage))); }
@Test public void shouldSetMaxInputDigitIfItHasTransition() { setAdherenceProvided(patient1); AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2, patient3)); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); Node actualNode = adherenceSummaryTransition.getDestinationNode("", flowSession); assertThat(actualNode.getMaxTransitionInputDigit(), is(1)); }
@Test public void shouldAddHangupTransitionWhenThereAreNoPatientsRemaining() { setAdherenceProvided(patient1); setAdherenceProvided(patient2); AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2)); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); mockCurrentDate(DateUtil.now()); Node actualNode = adherenceSummaryTransition.getDestinationNode("", flowSession); assertEquals(flowSession.get(IvrSession.CALL_STATUS), CallStatus.ADHERENCE_ALREADY_PROVIDED); assertEquals(new HangupTransition(), actualNode.getTransitions().get("hangup")); assertThat(actualNode.getOperations(), hasItem(isA(RecordCallStartTimeOperation.class))); }
@Test public void shouldSaveCallLogWhenProviderCallsOnDayOutsideWindow() { DateTime now = new DateTime(2012, 8, 8, 1, 1, 1, 1); AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2)); mockCurrentDate(now); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); Node destinationNode = adherenceSummaryTransition.getDestinationNode("", flowSession); Assert.assertThat( destinationNode.getOperations(), hasItem(isA(RecordCallStartTimeOperation.class))); assertEquals( flowSession.get(IvrSession.CALL_STATUS), CallStatus.OUTSIDE_ADHERENCE_CAPTURE_WINDOW); }
@Test public void shouldAddPromptsForWelcomeMessage_AdherenceSummary_AndCompletion_WhenThereAreNoPatientsRemaining() { setAdherenceProvided(patient1); setAdherenceProvided(patient2); AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2)); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); mockCurrentDate(DateUtil.now()); List<Prompt> expectedPrompts = new PromptBuilder(whpIvrMessage) .addAll(welcomeMessagePrompts(whpIvrMessage)) .addAll( adherenceSummaryWithCallCompletionPrompts( whpIvrMessage, adherenceSummary.countOfAllPatients(), adherenceSummary.countOfPatientsWithAdherence())) .buildList(); Node actualNode = adherenceSummaryTransition.getDestinationNode("", flowSession); assertThat(actualNode.getPrompts(), is(expectedPrompts)); }
public void shouldPlayWindowClosedPrompts_whenCalledBetweenWedToSat() { DateTime now = new DateTime(2012, 8, 8, 1, 1, 1, 1); AdherenceSummaryByProvider adherenceSummary = adherenceSummary(asList(patient1, patient2)); mockCurrentDate(now); when(adherenceDataService.getAdherenceSummary(PROVIDER_ID)).thenReturn(adherenceSummary); Node destinationNode = adherenceSummaryTransition.getDestinationNode("", flowSession); Node expectedNode = new Node() .addPrompts(welcomeMessagePrompts(whpIvrMessage)) .addPrompts(adherenceCaptureWindowClosedPrompts(whpIvrMessage)) .addTransition("hangup", new HangupTransition()); assertThat(destinationNode.getPrompts(), is(expectedNode.getPrompts())); assertThat(destinationNode.getTransitions(), is(expectedNode.getTransitions())); }