AnalysisController { @GetMapping(value = "/analysis/images") public List<ImageDTO> getImages() { LOGGER.info("Get Images"); assumeReady(); return analysisResult.getItems().stream() .filter(item -> item.getResultType() == ResultType.IMAGE || item.getResultType() == ResultType.IMAGE_LEGEND) .map(image -> ImageMapper.toDTO(analysisResult.getBaseDir(), image)) .collect(Collectors.toList()); }  @Value("${de.qaware.qav.analysis.filename}") void setFilename(String filename); @Value("${de.qaware.qav.graph.filename}") void setGraphFilename(String graphFilename); @PostConstruct void init(); @GetMapping(value = "/analysis") AnalysisResult getAnalysisResult(); @GetMapping(value = "/analysis/images") List<ImageDTO> getImages(); @GetMapping(value = "/analysis/images/{imageName}") @SuppressWarnings("squid:S2083") // Sonar does not believe that the input is checked. But it really is. ResponseEntity<Resource> getImage(@PathVariable String imageName);  }
@Test public void testGetImages() { AnalysisController ac = new AnalysisController(); ac.setFilename(BASEDIR + "qav-analysis-result.json"); ac.init(); List<ImageDTO> images = ac.getImages(); assertThat(images).hasSize(3); assertThat(images.get(0).getImageName()).isEqualTo("packageGraph"); assertThat(images.get(1).getImageName()).isEqualTo("packageCycleGraph"); assertThat(images.get(2).getImageName()).isEqualTo("legend"); }