@Test public void shouldBuildCallSummaryWithEmptyCallFlowDetailsWhenCallLogDoesNotHaveAnyFlows() { DateTime callStartTime = DateUtil.now(); CallLog callLog = new CallLog(); callLog.setStartTime(callStartTime); callLog.setEndTime(callStartTime.plusMinutes(1)); CallLogSummary logSummary = new CallLogSummaryBuilder(allPatients, new Patients(allPatients.getAll()), allIVRLanguages) .build(callLog); assertNotNull(logSummary.getFlowDetailsMap()); }
private void setUpCallLog(CallDirection callDirection) { String patientDocId = "patientDocId"; String clinicId = "clinicId"; callLog = new CallLog(patientDocId); callLog.patientId("patientId"); initiatedTime = DateUtil.newDateTime(2011, 10, 10, 10, 9, 10); startTime = DateUtil.newDateTime(2011, 10, 10, 10, 10, 10); callLog.setStartTime(initiatedTime); callLog.setEndTime(DateUtil.now()); callLog.setCallDirection(callDirection); callLog.clinicId(clinicId); callLog.setPhoneNumber("1234567890"); callLog.callLanguage("en"); final CallEvent callEvent = mock(CallEvent.class); when(callEvent.getTimeStamp()).thenReturn(startTime); CallEventCustomData customData = new CallEventCustomData(); customData.add(TAMAIVRContext.MESSAGE_CATEGORY_NAME, "All Messages"); when(callEvent.getData()).thenReturn(customData); callLog.setCallEvents( new ArrayList<CallEvent>() { { add(callEvent); } }); Clinic clinic = new Clinic(clinicId); Patient patient = PatientBuilder.startRecording() .withId(patientDocId) .withPatientId("patientId") .withGender(Gender.newGender("Male")) .withClinic(clinic) .withTravelTimeToClinicInDays(1) .withTravelTimeToClinicInHours(1) .withTravelTimeToClinicInMinutes(1) .withDateOfBirth(DateUtil.today().minusYears(40)) .build(); CallLogView callLogView = mock(CallLogView.class); clinic.setName("clinicName"); when(allIVRLanguages.getByCode("en")).thenReturn(IVRLanguage.newIVRLanguage("English", "en")); when(allPatients.getAll()).thenReturn(asList(patient)); when(callLogViewMapper.toCallLogView(asList(callLog))).thenReturn(asList(callLogView)); callLogSummaryBuilder = new CallLogSummaryBuilder(allPatients, new Patients(allPatients.getAll()), allIVRLanguages); }
private void setupCallLog() { callLog = new CallLog("patientDocumentId"); callLog.setStartTime(DateUtil.now()); callLog.setCallDirection(CallDirection.Inbound); callLog.setCallEvents(asList(messagesEvent(), endOfCallEvent())); }