LegacyDetectorRepositoryImpl implements LegacyDetectorRepository { @Override public List<DetectorDocument> findByCreatedBy(String user) { val queryBuilder = QueryBuilders.termQuery("createdBy", user); val searchSourceBuilder = elasticsearchUtil.getSourceBuilder(queryBuilder).size(DEFAULT_ES_RESULTS_SIZE); val searchRequest = elasticsearchUtil.getSearchRequest(searchSourceBuilder, DETECTOR_INDEX, DETECTOR_DOC_TYPE); return getDetectorsFromElasticSearch(searchRequest); }  @Override UUID createDetector(DetectorDocument document); @Override void deleteDetector(String uuid); @Override void updateDetector(String uuid, DetectorDocument document); @Override DetectorDocument findByUuid(String uuid); @Override List<DetectorDocument> findByCreatedBy(String user); @Override void toggleDetector(String uuid, Boolean enabled); @Override void trustDetector(String uuid, Boolean trusted); @Override List<DetectorDocument> getLastUpdatedDetectors(long interval); @Override List<DetectorDocument> getLastUpdatedDetectors(String fromDate, String toDate);  }
@Test public void testFindByCreatedBy() { List<DetectorDocument> actualDetectors = repoUnderTest.findByCreatedBy("kashah"); assertNotNull(actualDetectors); assertCheck(actualDetectors); }