AnomalyController { @PostMapping(path = "/anomalies", consumes = "application/json", produces = "application/json") public List<OutlierDetectorResult> getAnomalies(@RequestBody AnomalyRequest request) { List<OutlierDetectorResult> detectorResults = anomalyRepository.getAnomalies(request); if (detectorResults == null || detectorResults.isEmpty()) { throw new IllegalArgumentException("Invalid request: " + request); } return detectorResults; }  @PostMapping(path = "/anomalies", consumes = "application/json", produces = "application/json") List<OutlierDetectorResult> getAnomalies(@RequestBody AnomalyRequest request);  }
@Test public void testGetAnomalies() { List<OutlierDetectorResult> actualResults = controller.getAnomalies(request); assertNotNull(actualResults); assertSame(results, actualResults); }
@Test(expected = IllegalArgumentException.class) public void testGetAnomalies_illegal_args() { when(anomalyRepository.getAnomalies(request)).thenReturn(null); controller.getAnomalies(request); }
@Test(expected = IllegalArgumentException.class) public void testGetAnomalies_illegal_args1() { when(anomalyRepository.getAnomalies(request)).thenReturn(new ArrayList<>()); controller.getAnomalies(request); }