ScreenshotCommand extends Command { @Override public void execute() throws CommandException { consoleWriter.newLine().a("Upload Screenshots to repository: ").fg(Color.CYAN).a(repositoryParam).println(2); Repository repository = commandHelper.findRepositoryByName(repositoryParam); commandDirectories = new CommandDirectories(sourceDirectoryParam); localeMappings = localeMappingHelper.getLocaleMapping(localeMappingParam); repositoryLocales = commandHelper.getSortedRepositoryLocales(repository); List<Path> listFilesWithExtensionInSourceDirectory = commandDirectories.listFilesWithExtensionInSourceDirectory("png", "jpg", "jpeg", "gif"); ScreenshotRun screenshotRun = new ScreenshotRun(); screenshotRun.setRepository(repository); if (screenshotRunName == null) { screenshotRun.setName(UUID.randomUUID().toString()); } else { screenshotRun.setName(screenshotRunName); } for (Path imagePath : listFilesWithExtensionInSourceDirectory) { processImage(imagePath, screenshotRun); } screenshotClient.uploadScreenshots(screenshotRun); }  @Override void execute();  }
@Test public void execute() throws Exception { String repoName = testIdWatcher.getEntityName("screenshot_execute"); Repository repository = repositoryService.createRepository(repoName, repoName + " description", null, false); repositoryService.addRepositoryLocale(repository, "fr-FR"); repositoryService.addRepositoryLocale(repository, "ja-JP"); repositoryService.addRepositoryLocale(repository, "en-US"); getL10nJCommander().run("push", "-r", repository.getName(), "-s", getInputResourcesTestDir().toString()); getL10nJCommander().run("import", "-r", repository.getName(), "-s", getInputResourcesTestDir().toString()); getL10nJCommander().run("screenshot", "-r", repository.getName(), "-s", getInputResourcesTestDir().toString()); getL10nJCommander().run("screenshot", "-r", repository.getName(), "-rn", "test1", "-s", getInputResourcesTestDir().toString()); getL10nJCommander().run("screenshot", "-r", repository.getName(), "-rn", "test1", "-s", getInputResourcesTestDir().toString()); }