DetectorMappingRepositoryImpl implements DetectorMappingRepository { @Override public void disableDetectorMapping(String id) { val detectorMapping = findDetectorMapping(id); if (detectorMapping.isEnabled()) { final PercolatorDetectorMapping percolatorDetectorMapping = new PercolatorDetectorMapping() .setUser(detectorMapping.getUser()) .setConsumerDetectorMapping(detectorMapping.getDetector()) .setQuery(QueryUtil.buildQuery(detectorMapping.getExpression())) .setEnabled(false) .setLastModifiedTimeInMillis(System.currentTimeMillis()) .setCreatedTimeInMillis(detectorMapping.getCreatedTimeInMillis()); updateDetectorMapping(id, percolatorDetectorMapping); } } @Autowired  DetectorMappingRepositoryImpl(MetricRegistry metricRegistry); @Override String createDetectorMapping(CreateDetectorMappingRequest request); @Override MatchingDetectorsResponse findMatchingDetectorMappings(List<Map<String, String>> tagsList); @Override DetectorMapping findDetectorMapping(String id); @Override List<DetectorMapping> findLastUpdated(int timeInSeconds); @Override List<DetectorMapping> search(SearchMappingsRequest request); @Override void disableDetectorMapping(String id); @Override void deleteDetectorMapping(String id); @Override void deleteMappingsByDetectorUUID(UUID uuid);  }
@Test public void disableDetectorMapping() throws IOException { val id = "adsvade8^szx"; GetResponse getResponse = mockGetResponse(id); when(legacyElasticSearchClient.get(any(GetRequest.class), eq(RequestOptions.DEFAULT))).thenReturn(getResponse); repoUnderTest.disableDetectorMapping(id); verify(legacyElasticSearchClient, atLeastOnce()).get(any(GetRequest.class), eq(RequestOptions.DEFAULT)); }