@Test public void toDTO() { Result p1 = new Result(ResultType.IMAGE, "p1", 12, 24); Result p2 = new Result(ResultType.IMAGE, "p2", 12, 24); Result p3 = new Result(ResultType.TEXT, "p4"); ImageDTO i1 = ImageMapper.toDTO(BASEDIR, p1); ImageDTO i2 = ImageMapper.toDTO(BASEDIR, p2); ImageDTO i3 = ImageMapper.toDTO(BASEDIR, p3); assertThat(i1).isNotNull(); assertThat(i1.getFilenamePNG()).isEqualTo("p1.png"); assertThat(i1.getFilenameSVG()).isEqualTo("p1.svg"); assertThat(i1.getFilenameGraphml()).isEqualTo("p1.graphml"); assertThat(i2).isNotNull(); assertThat(i2.getFilenamePNG()).isEqualTo("p2.png"); assertThat(i2.getFilenameSVG()).isNull(); assertThat(i2.getFilenameGraphml()).isNull(); assertThat(i3).isNotNull(); assertThat(i3.getFilenamePNG()).isNull(); assertThat(i3.getFilenameSVG()).isNull(); assertThat(i3.getFilenameGraphml()).isNull(); }
public static ImageDTO toDTO(String baseDir, Result image) { Objects.requireNonNull(image, "image"); ImageDTO imageDTO = new ImageDTO(); imageDTO.setImageName(image.getFilename()); imageDTO.setFilenamePNG(fileIfExists(baseDir, image.getFilename() + ".png")); imageDTO.setFilenameSVG(fileIfExists(baseDir, image.getFilename() + ".svg")); imageDTO.setFilenameGraphml(fileIfExists(baseDir, image.getFilename() + ".graphml")); imageDTO.setNoNodes(image.getNoNodes()); imageDTO.setNoEdges(image.getNoEdges()); return imageDTO; }
ImageMapper { public static ImageDTO toDTO(String baseDir, Result image) { Objects.requireNonNull(image, "image"); ImageDTO imageDTO = new ImageDTO(); imageDTO.setImageName(image.getFilename()); imageDTO.setFilenamePNG(fileIfExists(baseDir, image.getFilename() + ".png")); imageDTO.setFilenameSVG(fileIfExists(baseDir, image.getFilename() + ".svg")); imageDTO.setFilenameGraphml(fileIfExists(baseDir, image.getFilename() + ".graphml")); imageDTO.setNoNodes(image.getNoNodes()); imageDTO.setNoEdges(image.getNoEdges()); return imageDTO; } }
ImageMapper { public static ImageDTO toDTO(String baseDir, Result image) { Objects.requireNonNull(image, "image"); ImageDTO imageDTO = new ImageDTO(); imageDTO.setImageName(image.getFilename()); imageDTO.setFilenamePNG(fileIfExists(baseDir, image.getFilename() + ".png")); imageDTO.setFilenameSVG(fileIfExists(baseDir, image.getFilename() + ".svg")); imageDTO.setFilenameGraphml(fileIfExists(baseDir, image.getFilename() + ".graphml")); imageDTO.setNoNodes(image.getNoNodes()); imageDTO.setNoEdges(image.getNoEdges()); return imageDTO; } private  ImageMapper(); }
ImageMapper { public static ImageDTO toDTO(String baseDir, Result image) { Objects.requireNonNull(image, "image"); ImageDTO imageDTO = new ImageDTO(); imageDTO.setImageName(image.getFilename()); imageDTO.setFilenamePNG(fileIfExists(baseDir, image.getFilename() + ".png")); imageDTO.setFilenameSVG(fileIfExists(baseDir, image.getFilename() + ".svg")); imageDTO.setFilenameGraphml(fileIfExists(baseDir, image.getFilename() + ".graphml")); imageDTO.setNoNodes(image.getNoNodes()); imageDTO.setNoEdges(image.getNoEdges()); return imageDTO; } private  ImageMapper(); static ImageDTO toDTO(String baseDir, Result image); }
ImageMapper { public static ImageDTO toDTO(String baseDir, Result image) { Objects.requireNonNull(image, "image"); ImageDTO imageDTO = new ImageDTO(); imageDTO.setImageName(image.getFilename()); imageDTO.setFilenamePNG(fileIfExists(baseDir, image.getFilename() + ".png")); imageDTO.setFilenameSVG(fileIfExists(baseDir, image.getFilename() + ".svg")); imageDTO.setFilenameGraphml(fileIfExists(baseDir, image.getFilename() + ".graphml")); imageDTO.setNoNodes(image.getNoNodes()); imageDTO.setNoEdges(image.getNoEdges()); return imageDTO; } private  ImageMapper(); static ImageDTO toDTO(String baseDir, Result image);  }