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

    String response = "{\"_id\" : \"couch_id\", \"child_name\":\"subhas\",\"unique_identifier\":\"78223s4h1e468f5200edc\"}";
    Enquiry enquiry = spy(new Enquiry(response, "createdBy"));
    doReturn(true).when(enquiry).isNew();
    BasicHttpResponse httpResponse = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_INTERNAL_SERVER_ERROR, "ERROR");
    httpResponse.setEntity(new StringEntity(response, ContentType.APPLICATION_JSON));
    getFakeHttpLayer().addHttpResponseRule("POST", "http://whatever/api/enquiries/", httpResponse);
    new EnquirySyncService(mockContext(), enquiryHttpDao, enquiryRepository).sync(enquiry, user);
    assertFalse(enquiry.isSynced());
    assertNull(enquiry.getLastUpdatedAt());
}