@Test(expected = SyncFailedException.class)
public void shouldNotRemoveHistoriesAfterFailedSync() throws Exception {

    Child childSpy = spy(new Child("{\"_id\" : \"couch_id\", \"child_name\":\"subhas\",\"unique_identifier\":\"78223s4h1e468f5200edc\"}"));
    doReturn(false).when(childSpy).isNew();
    childHttpDao = mock(EntityHttpDao.class);
    doThrow(new HTTPException(404)).when(childHttpDao).update(eq(childSpy), anyString(), any(Map.class));
    new GenericSyncService<Child>(mediaSyncHelper, childHttpDao, repository).sync(childSpy, "");
    verify(childSpy, never()).remove(History.HISTORIES);
}