ScreenshotCommand extends Command { Path getMetadataFilenameForImage(Path imagePath) { String imageFilename = imagePath.getFileName().toString(); String metadataFilename = FilenameUtils.getBaseName(imageFilename) + ".json"; return imagePath.resolveSibling(metadataFilename); }  @Override void execute();  }
@Test public void testGetMetadataFilenameForImage() throws Exception { ScreenshotCommand screenshotCommand = new ScreenshotCommand(); Path path = Paths.get("a", "b", "img.png"); Path expected = Paths.get("a", "b", "img.json"); assertEquals(expected, screenshotCommand.getMetadataFilenameForImage(path)); }