@Test
public void testGetHitsWithoutMetadata() {

    final SearchResult searchResult = new SearchResult(new Gson());
    searchResult.setSucceeded(true);
    searchResult.setJsonString(json);
    searchResult.setJsonObject(new JsonParser().parse(json).getAsJsonObject());
    searchResult.setPathToResult("hits/hits/_source");
    assertTrue(getFirstHitSource(searchResult.getHits(Object.class)).containsKey(SearchResult.ES_METADATA_ID));
    assertFalse(getFirstHitSource(searchResult.getHits(Object.class, false)).containsKey(SearchResult.ES_METADATA_ID));
    assertTrue(getFirstHitSource(searchResult.getHits(Object.class, Object.class)).containsKey(SearchResult.ES_METADATA_ID));
    assertFalse(getFirstHitSource(searchResult.getHits(Object.class, Object.class, false)).containsKey(SearchResult.ES_METADATA_ID));
}