diff --git a/src/main/java/com/crowdin/cli/commands/Actions.java b/src/main/java/com/crowdin/cli/commands/Actions.java index 9040beec5..553ef60e2 100644 --- a/src/main/java/com/crowdin/cli/commands/Actions.java +++ b/src/main/java/com/crowdin/cli/commands/Actions.java @@ -24,7 +24,7 @@ public interface Actions { NewAction download( - FilesInterface files, boolean noProgress, List languageIds, boolean pseudo, String branchName, + FilesInterface files, boolean noProgress, List languageIds, List excludeLanguageIds, boolean pseudo, String branchName, boolean ignoreMatch, boolean isVerbose, boolean plainView, boolean userServerSources, boolean keepArchive ); diff --git a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java index d0fd70c71..2b9c388c6 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/CliActions.java +++ b/src/main/java/com/crowdin/cli/commands/actions/CliActions.java @@ -26,10 +26,10 @@ public class CliActions implements Actions { @Override public NewAction download( - FilesInterface files, boolean noProgress, List languageIds, boolean pseudo, String branchName, + FilesInterface files, boolean noProgress, List languageIds, List excludeLanguageIds, boolean pseudo, String branchName, boolean ignoreMatch, boolean isVerbose, boolean plainView, boolean useServerSources, boolean keepArchive ) { - return new DownloadAction(files, noProgress, languageIds, pseudo, branchName, ignoreMatch, isVerbose, plainView, useServerSources, keepArchive); + return new DownloadAction(files, noProgress, languageIds, excludeLanguageIds, pseudo, branchName, ignoreMatch, isVerbose, plainView, useServerSources, keepArchive); } @Override diff --git a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java index 452eec7d8..13d4713b5 100644 --- a/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java +++ b/src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java @@ -58,6 +58,7 @@ class DownloadAction implements NewAction { private FilesInterface files; private boolean noProgress; private List languageIds; + private List excludeLanguageIds; private boolean pseudo; private String branchName; private boolean ignoreMatch; @@ -69,12 +70,13 @@ class DownloadAction implements NewAction { private Outputter out; public DownloadAction( - FilesInterface files, boolean noProgress, List languageIds, boolean pseudo, String branchName, + FilesInterface files, boolean noProgress, List languageIds, List excludeLanguageIds, boolean pseudo, String branchName, boolean ignoreMatch, boolean isVerbose, boolean plainView, boolean useServerSources, boolean keepArchive ) { this.files = files; this.noProgress = noProgress || plainView; this.languageIds = languageIds; + this.excludeLanguageIds = excludeLanguageIds; this.pseudo = pseudo; this.branchName = branchName; this.ignoreMatch = ignoreMatch; @@ -115,6 +117,12 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) { .orElseThrow(() -> new RuntimeException( String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), lang)))) .collect(Collectors.toList()); + List excludeLanguages = excludeLanguageIds == null ? new ArrayList<>() : excludeLanguageIds.stream() + .map(lang -> project.findLanguageById(lang, true) + .orElseThrow(() -> new RuntimeException( + String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), lang)))) + .collect(Collectors.toList()); + Optional branch = Optional.ofNullable(project.getBranch()); Map serverSources = ProjectFilesUtils.buildFilePaths(project.getDirectories(), project.getFiles()); @@ -154,16 +162,24 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) { } tempDirs.put(downloadedFiles.getLeft(), downloadedFiles.getRight()); } else { - List forLanguages = languages != null ? languages : project.getProjectLanguages(true); + List forLanguages = languages != null ? languages : + project.getProjectLanguages(true).stream() + .filter(language -> !excludeLanguages.contains(language)) + .collect(Collectors.toList()); + if (!plainView) { out.println((languageIds != null) ? OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.build_language_archive"), String.join(", ", languageIds))) : OK.withIcon(RESOURCE_BUNDLE.getString("message.build_archive"))); } CrowdinTranslationCreateProjectBuildForm templateRequest = new CrowdinTranslationCreateProjectBuildForm(); + if (languages != null) { templateRequest.setTargetLanguageIds(languages.stream().map(Language::getId).collect(Collectors.toList())); + } else if (!excludeLanguages.isEmpty()) { + templateRequest.setTargetLanguageIds(forLanguages.stream().map(Language::getId).collect(Collectors.toList())); } + branch .map(Branch::getId) .ifPresent(templateRequest::setBranchId); diff --git a/src/main/java/com/crowdin/cli/commands/picocli/DownloadSubcommand.java b/src/main/java/com/crowdin/cli/commands/picocli/DownloadSubcommand.java index 466a59601..afc8f3117 100644 --- a/src/main/java/com/crowdin/cli/commands/picocli/DownloadSubcommand.java +++ b/src/main/java/com/crowdin/cli/commands/picocli/DownloadSubcommand.java @@ -6,8 +6,10 @@ import com.crowdin.cli.commands.functionality.FsFiles; import com.crowdin.cli.properties.ParamsWithFiles; import com.crowdin.cli.properties.PropertiesWithFiles; +import org.apache.commons.lang3.ArrayUtils; import picocli.CommandLine; +import java.util.ArrayList; import java.util.List; @CommandLine.Command( @@ -31,6 +33,9 @@ class DownloadSubcommand extends ActCommandWithFiles { @CommandLine.Option(names = {"-l", "--language"}, paramLabel = "...", order = -2) protected List languageIds; + @CommandLine.Option(names = {"-el", "--exclude-language"}, paramLabel = "...", order = -2) + protected List excludeLanguageIds; + @CommandLine.Option(names = {"--pseudo"}, descriptionKey = "crowdin.download.pseudo", order = -2) protected boolean pseudo; @@ -62,7 +67,7 @@ class DownloadSubcommand extends ActCommandWithFiles { protected NewAction getAction(Actions actions) { return (dryrun) ? actions.listTranslations(noProgress, treeView, false, plainView, all, true) - : actions.download(new FsFiles(), noProgress, languageIds, pseudo, branchName, ignoreMatch, isVerbose, plainView, all, keepArchive); + : actions.download(new FsFiles(), noProgress, languageIds, excludeLanguageIds, pseudo, branchName, ignoreMatch, isVerbose, plainView, all, keepArchive); } @Override @@ -74,4 +79,13 @@ protected boolean isAnsi() { protected void updateParams(ParamsWithFiles params) { params.setExportOptions(skipTranslatedOnly, skipUntranslatedFiles, exportApprovedOnly); } + + @Override + protected List checkOptions() { + List errors = new ArrayList<>(); + if (languageIds != null && excludeLanguageIds != null) { + errors.add(RESOURCE_BUNDLE.getString("error.download.include_exclude_lang_conflict")); + } + return errors; + } } diff --git a/src/main/resources/messages/messages.properties b/src/main/resources/messages/messages.properties index 3faea428f..0dec83763 100755 --- a/src/main/resources/messages/messages.properties +++ b/src/main/resources/messages/messages.properties @@ -41,7 +41,8 @@ tree.dryrun=List contents of directories in a tree-like format in dryrun mode crowdin.download.usage.description=Download the latest translations from Crowdin to the specified place crowdin.download.usage.customSynopsis=@|fg(green) crowdin |@(@|fg(green) download|@|@|fg(green) pull|@) [CONFIG OPTIONS] [OPTIONS] crowdin.download.ignore-match=Ignore warning message about a configuration change -crowdin.download.language=Use this option to download translations for a single specified language. Default: all +crowdin.download.language=Download translations for the specified language. Can be specified multiple times +crowdin.download.exclude-language=Skip the language during download. Can be specified multiple times crowdin.download.pseudo=Download pseudo-localized translation files crowdin.download.all=Download files even if local sources are missing @@ -341,6 +342,7 @@ error.language_not_exist=Language '%s' doesn't exist in the project. Try specify error.languages_not_exist=Language(s) %s doesn't exist in the project. Try specifying another language code(s) error.building_translation=Failed to build translation. Please contact our support team for help error.downloading_file=Failed to download ZIP archive. Try to run the command once again +error.download.include_exclude_lang_conflict=The '--language' and '--exclude-language' options can't be used simultaneously error.extracting_files=Failed to extract files. Try to run the application with admin permission error.archive_not_exist=Archive '%s' wasn't found. Try to run the application with admin permission error.creatingDirectory=Failed to extract files. Couldn't create a directory for files extraction. Try to run the application with admin permission diff --git a/src/test/java/com/crowdin/cli/commands/actions/CliActionsTest.java b/src/test/java/com/crowdin/cli/commands/actions/CliActionsTest.java index 3885fe477..901c575f8 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/CliActionsTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/CliActionsTest.java @@ -14,7 +14,7 @@ public class CliActionsTest { @Test public void testDownload() { - assertNotNull(actions.download(new FsFiles(), false, null, false, null, false, false, false, false, false)); + assertNotNull(actions.download(new FsFiles(), false, null, null, false, null, false, false, false, false, false)); } @Test diff --git a/src/test/java/com/crowdin/cli/commands/actions/DownloadActionTest.java b/src/test/java/com/crowdin/cli/commands/actions/DownloadActionTest.java index 162dc71d5..25e4f707e 100644 --- a/src/test/java/com/crowdin/cli/commands/actions/DownloadActionTest.java +++ b/src/test/java/com/crowdin/cli/commands/actions/DownloadActionTest.java @@ -58,7 +58,7 @@ public static ProjectBuild buildProjectBuild(Long buildId, Long projectId, Strin } @Test - public void testEmptyProject() throws ResponseException, IOException { + public void testEmptyProject() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -87,7 +87,7 @@ public void testEmptyProject() throws ResponseException, IOException { })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -103,7 +103,7 @@ public void testEmptyProject() throws ResponseException, IOException { } @Test - public void testProjectOneFittingFile() throws ResponseException, IOException { + public void testProjectOneFittingFile() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -137,7 +137,7 @@ public void testProjectOneFittingFile() throws ResponseException, IOException { })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null,false, null, false, false, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -159,7 +159,7 @@ public void testProjectOneFittingFile() throws ResponseException, IOException { } @Test - public void testProjectOneFittingFile_WithExportApprovedOnly_WithSkipUntranslatedFiles() throws ResponseException, IOException { + public void testProjectOneFittingFile_WithExportApprovedOnly_WithSkipUntranslatedFiles() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -198,7 +198,7 @@ public void testProjectOneFittingFile_WithExportApprovedOnly_WithSkipUntranslate })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -254,7 +254,7 @@ public void testProjectDownloadWithKeepArchive() throws IOException { })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, true); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, true); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -275,7 +275,7 @@ public void testProjectDownloadWithKeepArchive() throws IOException { } @Test - public void testProjectOneFittingFile_LongBuild() throws ResponseException, IOException { + public void testProjectOneFittingFile_LongBuild() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -313,7 +313,7 @@ public void testProjectOneFittingFile_LongBuild() throws ResponseException, IOEx })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -336,7 +336,7 @@ public void testProjectOneFittingFile_LongBuild() throws ResponseException, IOEx } @Test - public void testProjectOneFittingOneUnfittingFile_LongBuild() throws ResponseException, IOException { + public void testProjectOneFittingOneUnfittingFile_LongBuild() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -374,7 +374,7 @@ public void testProjectOneFittingOneUnfittingFile_LongBuild() throws ResponseExc })); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -396,7 +396,7 @@ public void testProjectOneFittingOneUnfittingFile_LongBuild() throws ResponseExc } @Test - public void testProjectOneFittingOneUnfittingOneWithUnfoundSourceFile_LongBuild() throws ResponseException, IOException { + public void testProjectOneFittingOneUnfittingOneWithUnfoundSourceFile_LongBuild() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -435,7 +435,7 @@ public void testProjectOneFittingOneUnfittingOneWithUnfoundSourceFile_LongBuild( })); NewAction action = - new DownloadAction(files, false, null, false, null, false, true, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, true, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -457,7 +457,7 @@ public void testProjectOneFittingOneUnfittingOneWithUnfoundSourceFile_LongBuild( } @Test - public void testProjectOneFittingFile_WithLanguageMapping() throws ResponseException, IOException { + public void testProjectOneFittingFile_WithLanguageMapping() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -497,7 +497,7 @@ public void testProjectOneFittingFile_WithLanguageMapping() throws ResponseExcep })); NewAction action = - new DownloadAction(files, false, null, false, null, false, true, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, true, false, false, false); action.act(Outputter.getDefault(), pb, client); verify(client).downloadFullProject(null); @@ -519,7 +519,7 @@ public void testProjectOneFittingFile_WithLanguageMapping() throws ResponseExcep } @Test - public void testProjectOneFittingFile_FailBuild() throws ResponseException, IOException { + public void testProjectOneFittingFile_FailBuild() { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -542,7 +542,7 @@ public void testProjectOneFittingFile_FailBuild() throws ResponseException, IOEx FilesInterface files = mock(FilesInterface.class); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); verify(client).downloadFullProject(null); @@ -553,7 +553,7 @@ public void testProjectOneFittingFile_FailBuild() throws ResponseException, IOEx } @Test - public void testProjectOneFittingFile_failDownloadProject() throws ResponseException, IOException { + public void testProjectOneFittingFile_failDownloadProject() { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -568,7 +568,7 @@ public void testProjectOneFittingFile_failDownloadProject() throws ResponseExcep FilesInterface files = mock(FilesInterface.class); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); verify(client).downloadFullProject(null); @@ -578,7 +578,7 @@ public void testProjectOneFittingFile_failDownloadProject() throws ResponseExcep } @Test - public void testProjectOneFittingFile_failDeleteFile() throws ResponseException, IOException { + public void testProjectOneFittingFile_failDeleteFile() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -616,7 +616,7 @@ public void testProjectOneFittingFile_failDeleteFile() throws ResponseException, .when(files).deleteFile(any()); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); // assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); action.act(Outputter.getDefault(), pb, client); @@ -639,7 +639,7 @@ public void testProjectOneFittingFile_failDeleteFile() throws ResponseException, } @Test - public void testProjectOneFittingFile_failDownloadingException() throws ResponseException, IOException { + public void testProjectOneFittingFile_failDownloadingException() { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -661,7 +661,7 @@ public void testProjectOneFittingFile_failDownloadingException() throws Response FilesInterface files = mock(FilesInterface.class); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); verify(client).downloadFullProject(null); @@ -673,7 +673,7 @@ public void testProjectOneFittingFile_failDownloadingException() throws Response } @Test - public void testProjectOneFittingFile_failWritingFile() throws ResponseException, IOException { + public void testProjectOneFittingFile_failWritingFile() throws IOException { NewPropertiesWithFilesUtilBuilder pbBuilder = NewPropertiesWithFilesUtilBuilder .minimalBuiltPropertiesBean("*", Utils.PATH_SEPARATOR + "%original_file_name%-CR-%locale%") .setBasePath(project.getBasePath()); @@ -699,7 +699,7 @@ public void testProjectOneFittingFile_failWritingFile() throws ResponseException .writeToFile(any(), any()); NewAction action = - new DownloadAction(files, false, null, false, null, false, false, false, false, false); + new DownloadAction(files, false, null, null, false, null, false, false, false, false, false); assertThrows(RuntimeException.class, () -> action.act(Outputter.getDefault(), pb, client)); verify(client).downloadFullProject(null); diff --git a/src/test/java/com/crowdin/cli/commands/picocli/DownloadSubcommandTest.java b/src/test/java/com/crowdin/cli/commands/picocli/DownloadSubcommandTest.java index ef3a21c7d..401c123b3 100644 --- a/src/test/java/com/crowdin/cli/commands/picocli/DownloadSubcommandTest.java +++ b/src/test/java/com/crowdin/cli/commands/picocli/DownloadSubcommandTest.java @@ -1,7 +1,18 @@ package com.crowdin.cli.commands.picocli; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +import static com.crowdin.cli.commands.picocli.GenericCommand.RESOURCE_BUNDLE; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.params.provider.Arguments.arguments; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.verify; @@ -12,7 +23,7 @@ public class DownloadSubcommandTest extends PicocliTestUtils { public void testDownload() { this.execute(CommandNames.DOWNLOAD, "--debug"); verify(actionsMock) - .download(any(), anyBoolean(), any(), anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); + .download(any(), anyBoolean(), any(), any(), anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); this.check(true); } @@ -23,4 +34,14 @@ public void testDownloadDryrun() { .listTranslations(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean()); this.check(true); } + + @Test + public void testSubCommandCheckInvalidOptions() { + DownloadSubcommand downloadSubcommand = new DownloadSubcommand(); + downloadSubcommand.languageIds = Arrays.asList("uk", "es-ES"); + downloadSubcommand.excludeLanguageIds = Arrays.asList("en"); + List errors = downloadSubcommand.checkOptions(); + assertThat(errors, Matchers.equalTo(Arrays.asList(RESOURCE_BUNDLE.getString("error.download.include_exclude_lang_conflict")))); + } + } diff --git a/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java b/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java index c19453c6d..82e334d84 100644 --- a/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java +++ b/src/test/java/com/crowdin/cli/commands/picocli/PicocliTestUtils.java @@ -58,7 +58,7 @@ void mockActions() { actionsMock = mock(Actions.class); actionMock = mock(NewAction.class); - when(actionsMock.download(any(), anyBoolean(), any(), anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean())) + when(actionsMock.download(any(), anyBoolean(), any(), any(), anyBoolean(), any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean())) .thenReturn(actionMock); when(actionsMock.generate(any(), any(), anyBoolean())) .thenReturn(actionMock);