mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Remove attribute config as required option
This commit is contained in:
@@ -65,9 +65,10 @@ class CoherentAttributeUpdaterTest {
|
||||
@MethodSource("findMatch")
|
||||
void findMatch(AttributeConfig attributeConfig, List<Pair<File, FileInfo>> fileInfoMock, boolean expectedMatch, int expectedMatchCount) throws InvocationTargetException, IllegalAccessException {
|
||||
CommandRunner commandRunner = new CommandRunner();
|
||||
new CommandLine(commandRunner).parseArgs("-l", "/arst", "-a", "ger:ger");
|
||||
new CommandLine(commandRunner).parseArgs("-a", "ger:ger", "/arst");
|
||||
InputConfig config = commandRunner.getConfig();
|
||||
CoherentAttributeUpdater updater = new CoherentAttributeUpdater(config, fileProcessor, null);
|
||||
AttributeChangeProcessor attributeChangeProcessor = new AttributeChangeProcessor(config.getPreferredSubtitles().toArray(new String[0]), config.getForcedKeywords(), config.getCommentaryKeywords(), config.getHearingImpaired());
|
||||
CoherentAttributeUpdater updater = new CoherentAttributeUpdater(config, fileProcessor, attributeChangeProcessor);
|
||||
Set<FileInfo> matchedFiles = new HashSet<>(fileInfoMock.size() * 2);
|
||||
|
||||
List<File> files = new ArrayList<>();
|
||||
|
||||
@@ -22,7 +22,7 @@ class ValidationExecutionStrategyTest {
|
||||
CommandRunner underTest = new CommandRunner();
|
||||
new CommandLine(underTest)
|
||||
.setExecutionStrategy(new ValidationExecutionStrategy())
|
||||
.parseArgs("-a", "ger:ger", "-l", TEST_FILE, "-m", TEST_MKVTOOLNIX_DIR);
|
||||
.parseArgs("-a", "ger:ger", "-m", TEST_MKVTOOLNIX_DIR, TEST_FILE);
|
||||
|
||||
assertEquals(TEST_FILE, underTest.getConfig().getLibraryPath().getPath().replace("\\", "/"));
|
||||
assertEquals(TEST_MKVTOOLNIX_DIR, underTest.getConfig().getMkvToolNix().getPath().replace("\\", "/"));
|
||||
@@ -30,17 +30,16 @@ class ValidationExecutionStrategyTest {
|
||||
|
||||
private static Stream<Arguments> validateFailure() {
|
||||
return Stream.of(
|
||||
Arguments.of(new String[]{"-a", "jpn:ger"}, "Error: Missing required argument(s): --library=<libraryPath>"),
|
||||
Arguments.of(new String[]{"-a", "jpn:ger", "-l"}, "Missing required parameter for option '--library' (<libraryPath>)"),
|
||||
Arguments.of(new String[]{"-l", "/arstarstarst"}, "Error: Missing required argument(s): --attribute-config=<attributeConfig>"),
|
||||
Arguments.of(new String[]{"-l", "/arstarstarst", "-a",}, "Missing required parameter for option '--attribute-config' at index 0 (<attributeConfig>)"),
|
||||
Arguments.of(new String[]{"-l", "/arstarstarst", "-a", "jpn:ger"}, "libraryPath does not exist"),
|
||||
Arguments.of(args("-m"), "Missing required parameter for option '--mkvtoolnix' (<mkvToolNix>)"),
|
||||
Arguments.of(args("-m", TEST_INVALID_DIR), "mkvToolNix does not exist"),
|
||||
Arguments.of(args("-t"), "Missing required parameter for option '--threads' (<threads>)"),
|
||||
Arguments.of(args("-t", "0"), "threads must be greater than or equal to 1"),
|
||||
Arguments.of(args("-t", "-1"), "threads must be greater than or equal to 1"),
|
||||
Arguments.of(args("-c", "-1"), "coherent must be greater than or equal to 0")
|
||||
Arguments.of(new String[]{"-a", "jpn:ger"}, "Error: Missing required argument(s): <libraryPath>"),
|
||||
Arguments.of(new String[]{"/arstarstarst"}, "libraryPath does not exist"),
|
||||
Arguments.of(new String[]{"/arstarstarst", "-a",}, "Missing required parameter for option '--attribute-config' at index 0 (<attributeConfig>)"),
|
||||
Arguments.of(new String[]{"/arstarstarst", "-a", "jpn:ger"}, "libraryPath does not exist"),
|
||||
Arguments.of(new String[]{"/arstarstarst", "-m"}, "Missing required parameter for option '--mkvtoolnix' (<mkvToolNix>)"),
|
||||
Arguments.of(new String[]{"./", "-m", TEST_INVALID_DIR}, "mkvToolNix does not exist"),
|
||||
Arguments.of(new String[]{"./", "-t"}, "Missing required parameter for option '--threads' (<threads>)"),
|
||||
Arguments.of(new String[]{"./", "-t", "0"}, "threads must be greater than or equal to 1"),
|
||||
Arguments.of(new String[]{"./", "-t", "-1"}, "threads must be greater than or equal to 1"),
|
||||
Arguments.of(new String[]{"./", "-c", "-1"}, "coherent must be greater than or equal to 0")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.util;
|
||||
public class TestUtil {
|
||||
|
||||
public static String[] args(String... args) {
|
||||
String[] staticArray = new String[]{"-l", "/", "-a", "jpn:ger"};
|
||||
String[] staticArray = new String[]{"-a", "jpn:ger", "/"};
|
||||
String[] result = new String[staticArray.length + args.length];
|
||||
System.arraycopy(staticArray, 0, result, 0, staticArray.length);
|
||||
System.arraycopy(args, 0, result, staticArray.length, args.length);
|
||||
System.arraycopy(args, 0, result, 0, args.length);
|
||||
System.arraycopy(staticArray, 0, result, args.length, staticArray.length);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user