@Test
public void should_save_tracing_when_give_item_values_and_item_values_map_have_register_date()
        throws IOException {

    String url = "http://35.61.65.113:8443";
    Mockito.when(PrimeroAppConfiguration.getApiBaseUrl()).thenReturn(url);
    String uniqueId = "test save tracing";
    ItemValuesMap itemValuesMap = new ItemValuesMap();
    itemValuesMap.addStringItem(RELATION_AGE, "10");
    itemValuesMap.addStringItem(CAREGIVER_NAME, "100");
    itemValuesMap.addStringItem(INQUIRY_DATE, "1/1/2000");
    List<String> photoPaths = Collections.EMPTY_LIST;
    TracingService tracingServiceSpy = spy(tracingService);
    when(tracingServiceSpy.generateUniqueId()).thenReturn(uniqueId);
    Tracing tracingTemp = new Tracing();
    when(tracingDao.save(any(Tracing.class))).thenReturn(tracingTemp);
    Tracing expected = new Tracing();
    when(tracingPhotoDao.save(tracingTemp, photoPaths)).thenReturn(expected);
    Tracing savedTracing = tracingServiceSpy.save(itemValuesMap, photoPaths);
    assertThat(savedTracing.getServerUrl(), is(TextUtils.lintUrl(url)));
    verify(tracingDao, times(1)).save(any(Tracing.class));
    verify(tracingPhotoDao, times(1)).save(any(Tracing.class), anyList());
}