コード例 #1
0
  @Test
  public void shouldTransitionToMenuRepeatWhenCallStateIs_EndOfFlow() {
    tamaIVRContext.callState(CallState.PUSH_MESSAGES_COMPLETE);
    tamaIVRContext.callDirection(CallDirection.Outbound);

    assertEquals(ControllerURLs.MENU_REPEAT, tamaCallFlowController.urlFor(kooKooIVRContext));
  }
コード例 #2
0
 @Test
 public void completionOfSymptomReportingTreeOrPreviousDosageReminderTreeShouldCompleteTheTrees() {
   tamaIVRContext.callDirection(CallDirection.Inbound);
   when(treeRegistry.isLeafTree(TAMATreeRegistry.REGIMEN_1_TO_6)).thenReturn(true);
   tamaCallFlowController.treeComplete(TAMATreeRegistry.REGIMEN_1_TO_6, kooKooIVRContext);
   assertEquals(CallState.ALL_TREES_COMPLETED, tamaIVRContext.callState());
 }
コード例 #3
0
 @Test
 public void
     whenCurrentDosageIsConfirmedAndWhenPreviousDosageHasBeenCaptured_AllTreesAreCompleted() {
   tamaIVRContext.callDirection(CallDirection.Outbound);
   tamaIVRContext.callState(CallState.AUTHENTICATED);
   when(pillModuleStrategy.previousDosageCaptured(tamaIVRContext)).thenReturn(true);
   tamaCallFlowController.treeComplete(TAMATreeRegistry.CURRENT_DOSAGE_CONFIRM, kooKooIVRContext);
   assertEquals(CallState.ALL_TREES_COMPLETED, tamaIVRContext.callState());
 }
コード例 #4
0
  @Test
  public void shouldTransitionToCurrentDosageReminderTreeForPatientOnDailyPillReminder() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.DailyPillReminder)
                .build());
    tamaIVRContext.callDirection(CallDirection.Outbound);

    assertEquals(
        TAMATreeRegistry.CURRENT_DOSAGE_REMINDER,
        tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #5
0
  @Test
  public void shouldNotRepeatOutboxCallTreeMoreThanOnceDuringOutboxCall() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.DailyPillReminder)
                .build());
    tamaIVRContext.addLastCompletedTreeToListOfCompletedTrees(TAMATreeRegistry.OUTBOX_CALL);
    tamaIVRContext.callDirection(CallDirection.Outbound);

    assertEquals(
        TAMATreeRegistry.MENU_TREE, tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #6
0
  @Test
  public void shouldTransitionToMenuTreeOnceFourDayRecallTreeIsPlayed() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.FourDayRecall)
                .build());
    tamaIVRContext.addLastCompletedTreeToListOfCompletedTrees(TAMATreeRegistry.FOUR_DAY_RECALL);
    tamaIVRContext.callDirection(CallDirection.Outbound);

    assertEquals(
        TAMATreeRegistry.MENU_TREE, tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #7
0
  @Test
  public void shouldNotTransitionToCurrentDosageReminderTreeIsPlayed_AndUserEntersWillTakeLater() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.DailyPillReminder)
                .build());
    tamaIVRContext.addLastCompletedTreeToListOfCompletedTrees(
        TAMATreeRegistry.CURRENT_DOSAGE_REMINDER);
    tamaIVRContext.callDirection(CallDirection.Outbound);

    assertEquals(
        TAMATreeRegistry.MENU_TREE, tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #8
0
  @Test
  public void shouldReturnFourDayRecallIncomingTreeWhenPatientIsSuspendedButOnWeeklyAdherence() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withStatus(Status.Suspended)
                .withCallPreference(CallPreference.FourDayRecall)
                .build());
    tamaIVRContext.callDirection(CallDirection.Inbound);

    assertEquals(
        TAMATreeRegistry.FOUR_DAY_RECALL_INCOMING_CALL,
        tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #9
0
  @Test
  public void shouldReturnMenuTreeWhenPatientIsSuspendedAndIsOnDailyPillReminder() {
    tamaIVRContext.callState(CallState.AUTHENTICATED);
    when(allPatients.get(null))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.DailyPillReminder)
                .withStatus(Status.Suspended)
                .build());
    tamaIVRContext.callDirection(CallDirection.Inbound);

    assertEquals(
        TAMATreeRegistry.INCOMING_MENU_TREE,
        tamaCallFlowController.decisionTreeName(kooKooIVRContext));
  }
コード例 #10
0
  @Test
  public void shouldReturnPullMessagesTreeWhenCallStateIsPullMessages() {
    tamaIVRContext.callState(CallState.PULL_MESSAGES_TREE);
    tamaIVRContext.callDirection(CallDirection.Inbound);
    tamaIVRContext.lastCompletedTree(TAMATreeRegistry.CURRENT_DOSAGE_CONFIRM);

    when(allPatients.get(anyString()))
        .thenReturn(
            PatientBuilder.startRecording()
                .withDefaults()
                .withCallPreference(CallPreference.DailyPillReminder)
                .build());

    String treeName = tamaCallFlowController.decisionTreeName(kooKooIVRContext);
    assertEquals(TAMATreeRegistry.PULL_MESSAGES_TREE, treeName);
  }
コード例 #11
0
  @Test
  public void outboxURLShouldBeReturnedWhenTheDecisionTreesAreComplete() {
    tamaIVRContext.callState(CallState.ALL_TREES_COMPLETED);
    tamaIVRContext.callDirection(CallDirection.Outbound);
    String patientId = "1234";
    tamaIVRContext.patientDocumentId(patientId);

    Patient patient =
        PatientBuilder.startRecording()
            .withDefaults()
            .withId(patientId)
            .withCallPreference(CallPreference.DailyPillReminder)
            .build();
    when(allPatients.get(patientId)).thenReturn(patient);

    assertEquals(ControllerURLs.PUSH_MESSAGES_URL, tamaCallFlowController.urlFor(kooKooIVRContext));
  }