@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());
  }
Esempio n. 3
0
 @JsonIgnore
 public SymptomReport merge(SymptomReport report) {
   setSymptomIds((List<String>) CollectionUtils.union(getSymptomIds(), report.getSymptomIds()));
   return this;
 }