@Test
public void search_successful() throws IOException {

    List<DetectorMapping> tagsList = new ArrayList<>();
    Map<String, String> tags = new HashMap<>();
    Long LastModifiedTimeInMillis = new Long(1554828886);
    Long CreatedTimeInMillis = new Long(1554828886);
    val searchIndex = "2";
    val lookUpTime = 100;
    val detectorUuid = "aeb4d849-847a-45c0-8312-dc0fcf22b639";
    SearchMappingsRequest searchMappingsRequest = new SearchMappingsRequest();
    SearchResponse searchResponse = mockSearchResponse(searchIndex, lookUpTime, detectorUuid);
    when(legacyElasticSearchClient.search(any(SearchRequest.class), eq(RequestOptions.DEFAULT))).thenReturn(searchResponse);
    Mockito.when(elasticsearchUtil.getSourceBuilder(any(QueryBuilder.class))).thenReturn(new SearchSourceBuilder());
    tagsList = repoUnderTest.search(searchMappingsRequest);
    verify(legacyElasticSearchClient, atLeastOnce()).search(any(SearchRequest.class), eq(RequestOptions.DEFAULT));
    assertNotNull("Response can't be null", tagsList);
    assertEquals(1, tagsList.size());
    assertEquals(UUID.fromString(detectorUuid), tagsList.get(0).getDetector().getUuid());
    assertEquals("test-user", tagsList.get(0).getUser().getId());
    assertEquals(LastModifiedTimeInMillis, Long.valueOf(tagsList.get(0).getLastModifiedTimeInMillis()));
    assertEquals(CreatedTimeInMillis, Long.valueOf(tagsList.get(0).getCreatedTimeInMillis()));
    assertTrue(tagsList.get(0).isEnabled());
}