@Test
public void testGetAnnotations() throws IOException {

    AnnotationQuery annotationQuery = new AnnotationQuery("scope1", "metric1", null, "unittest", 1557809359073L, 1557809599073L);
    List<AnnotationQuery> queries = new ArrayList<>();
    queries.add(annotationQuery);
    ElasticSearchAnnotationService spyService = _initializeSpyService(esAnnotationService, getReply, false);
    List<Annotation> annotations = spyService.getAnnotations(queries);
    Annotation expectedAnnotation = new Annotation("unittest", "16ab4b56311", "unittest", "scope1", "metric1", 1557809559073L);
    assertEquals(expectedAnnotation, annotations.get(0));
    ArgumentCaptor<Request> requestCaptor = ArgumentCaptor.forClass(Request.class);
    verify(restClient, times(1)).performRequest(requestCaptor.capture());
    Request capturedRequest = requestCaptor.getValue();
    String queryJson = convertToPrettyJson(EntityUtils.toString(capturedRequest.getEntity()));
    assertEquals(annotationQueryMustTermRange, queryJson);
    String expectedURL = "/argus-annotation-*/_search";
    assertEquals(expectedURL, capturedRequest.getEndpoint());
}