DetectorClient { public List<DetectorMapping> findUpdatedDetectorMappings(long timeInSecs) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_UPDATED_MAPPINGS_PATH, timeInSecs); try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting updated detectors mappings" + ": timeInSecs=" + timeInSecs + ", httpMethod=GET" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading updated detectors mappings" + ": timeInSecs=" + timeInSecs; throw new DetectorException(message, e); } if (result == null) { throw new DetectorException("Updated detector mappings are null"); } return result; }  DetectorDocument findDetectorDocument(UUID uuid); List<DetectorDocument> findUpdatedDetectorDocuments(long timeInSecs); void updatedDetectorLastUsed(UUID uuid); DetectorMatchResponse findMatchingDetectorMappings(List<Map<String, String>> tagsList); List<DetectorMapping> findUpdatedDetectorMappings(long timeInSecs); DetectorMapping findDetectorMappingByUuid(UUID uuid);  }
@Test public void testFindUpdatedDetectorMappings() { val mappings = clientUnderTest.findUpdatedDetectorMappings(TIME_PERIOD_VALID); assertNotNull(mappings); assertSame(mappings, mappings); }
@Test(expected = DetectorException.class) public void testFindUpdatedDetectorMappings_cantGet() { clientUnderTest.findUpdatedDetectorMappings(TIME_PERIOD_CANT_GET); }
@Test(expected = DetectorException.class) public void testFindUpdatedDetectorMappings_cantRead() { clientUnderTest.findUpdatedDetectorMappings(TIME_PERIOD_CANT_READ); }
@Test(expected = DetectorException.class) public void testFindUpdatedDetectorMappings_noMappings() { clientUnderTest.findUpdatedDetectorMappings(TIME_PERIOD_NO_MAPPINGS); }