AnnotationService extends EndpointService { public List<Annotation> getAnnotations(List<String> expressions) throws IOException, TokenExpiredException { StringBuilder requestUrl = new StringBuilder(RESOURCE); for (int i = 0; i < expressions.size(); i++) { requestUrl.append(i == 0 ? "?" : "&"); requestUrl.append("expression=").append(expressions.get(i)); } ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl.toString(), null); assertValidResponse(response, requestUrl.toString()); return fromJson(response.getResult(), new TypeReference<List<Annotation>>() { }); } AnnotationService(ArgusHttpClient client); List<Annotation> getAnnotations(List<String> expressions); PutResult putAnnotations(List<Annotation> annotations);  }
@Test public void testGetAnnotations() throws IOException, TokenExpiredException { try(ArgusService argusService = new ArgusService(getMockedClient("/AnnotationServiceTest.json"))) { AnnotationService annotationService = argusService.getAnnotationService(); List<String> expressions = Arrays.asList(new String[] { "-1d:TestScope:TestMetric{TestTag=TagValue}:TestType" }); List<Annotation> result = annotationService.getAnnotations(expressions); List<Annotation> expected = Arrays.asList(new Annotation[] { _constructAnnotation() }); assertEquals(expected, result); } }