@Test public void shouldSetAdviceGivenOnSymptomsReport() { SymptomReport expectedReport = new SymptomReport("patientDocumentId", "callId", DateUtil.now()); when(allSymptomReports.findByCallId("callId")).thenReturn(expectedReport); symptomRecordingService.saveAdviceGiven("patientDocumentId", "callId", "some advice"); verify(allSymptomReports).addOrReplace(expectedReport); assertEquals("some advice", expectedReport.getAdviceGiven()); }
@Test public void shouldRecordSymptomReported() { SymptomReport expectedReport = new SymptomReport("patientDocumentId", "callId", DateUtil.now()); expectedReport.addSymptomId(FEVER_ID); when(allSymptomReports.findByCallId("callId")).thenReturn(null); symptomRecordingService.save(FEVER_ID, "patientDocumentId", "callId", DateUtil.now()); ArgumentCaptor<SymptomReport> reportCapture = ArgumentCaptor.forClass(SymptomReport.class); verify(allSymptomReports).addOrReplace(reportCapture.capture()); assertEquals(expectedReport, reportCapture.getValue()); }
@Test public void shouldCreateNewSymptomsReportLog_WhenNotPresent_WhileSettingAdvice() { when(allSymptomReports.findByCallId("callId")).thenReturn(null); symptomRecordingService.saveAdviceGiven("patientDocumentId", "callId", "some advice"); ArgumentCaptor<SymptomReport> newSymptomReportCaptor = ArgumentCaptor.forClass(SymptomReport.class); verify(allSymptomReports).addOrReplace(newSymptomReportCaptor.capture()); assertEquals("callId", newSymptomReportCaptor.getValue().getCallId()); assertEquals("patientDocumentId", newSymptomReportCaptor.getValue().getPatientDocId()); assertEquals("some advice", newSymptomReportCaptor.getValue().getAdviceGiven()); }