|
@@ -2,20 +2,18 @@ package de.jplag.cli;
|
|
|
|
|
|
|
|
import static de.jplag.CommandLineArgument.ROOT_DIRECTORY;
|
|
import static de.jplag.CommandLineArgument.ROOT_DIRECTORY;
|
|
|
import static java.util.stream.Collectors.toSet;
|
|
import static java.util.stream.Collectors.toSet;
|
|
|
-import static org.junit.Assert.fail;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import de.jplag.CLI;
|
|
import de.jplag.CLI;
|
|
|
import de.jplag.CommandLineArgument;
|
|
import de.jplag.CommandLineArgument;
|
|
|
-import de.jplag.ExitException;
|
|
|
|
|
-import de.jplag.JPlag;
|
|
|
|
|
-import de.jplag.JPlagResult;
|
|
|
|
|
import de.jplag.options.JPlagOptions;
|
|
import de.jplag.options.JPlagOptions;
|
|
|
import net.sourceforge.argparse4j.inf.Namespace;
|
|
import net.sourceforge.argparse4j.inf.Namespace;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Test base for tests regarding the {@link CLI} and any {@link CommandLineArgument}.
|
|
|
|
|
|
|
+ * Test base for tests regarding the {@link CLI} and any {@link CommandLineArgument}. Solely tests if the arguments set
|
|
|
|
|
+ * via the command line interface are propagated correctly into options. JPlag is not executed for the different command
|
|
|
|
|
+ * line arguments, thus these tests do not test the functionality of the options during the comparison.
|
|
|
* @author Timur Saglam
|
|
* @author Timur Saglam
|
|
|
*/
|
|
*/
|
|
|
public class CommandLineInterfaceTest {
|
|
public class CommandLineInterfaceTest {
|
|
@@ -57,23 +55,4 @@ public class CommandLineInterfaceTest {
|
|
|
options = cli.buildOptionsFromArguments(namespace);
|
|
options = cli.buildOptionsFromArguments(namespace);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Runs JPlag via the command line interface. Sets {@link CommandLineInterfaceTest#cli},
|
|
|
|
|
- * {@link CommandLineInterfaceTest#namespace}, and {@link CommandLineInterfaceTest#options}.
|
|
|
|
|
- * @param arguments arguments are the command line interface arguments.
|
|
|
|
|
- * @return the result of the JPlag run.
|
|
|
|
|
- */
|
|
|
|
|
- protected JPlagResult runViaCLI(String... arguments) {
|
|
|
|
|
- buildOptionsFromCLI(arguments);
|
|
|
|
|
- try {
|
|
|
|
|
- JPlag program = new JPlag(options);
|
|
|
|
|
- return program.run();
|
|
|
|
|
- } catch (ExitException e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- fail(e.getMessage());
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- throw new IllegalStateException("Should never be reached!");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|