|
|
@@ -27,22 +27,22 @@ public class CommandLineInterfaceTest {
|
|
|
protected JPlagOptions options;
|
|
|
|
|
|
/**
|
|
|
- * 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.
|
|
|
+ * Creates a string for all arguments and their values that have been succesfully parsed.F
|
|
|
*/
|
|
|
- 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!");
|
|
|
+ private String parsedKeys(String... arguments) {
|
|
|
+ var keys = namespace.getAttrs().keySet().stream()
|
|
|
+ .filter(key -> key.equals(ROOT_DIRECTORY.flag()) || Arrays.stream(arguments).anyMatch(arg -> arg.contains("-" + key)));
|
|
|
+ return keys.map(it -> it + "=" + namespace.get(it)).collect(toSet()).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Builds a CLI string for a CLI argument and a value.
|
|
|
+ * @param argument is the CLI argument.
|
|
|
+ * @param value is the value for that argument.
|
|
|
+ * @return <code>"flag value"</code>
|
|
|
+ */
|
|
|
+ protected String buildArgument(CommandLineArgument argument, String value) {
|
|
|
+ return argument.flag() + "=" + value;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -58,22 +58,22 @@ public class CommandLineInterfaceTest {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Builds a CLI string for a CLI argument and a value.
|
|
|
- * @param argument is the CLI argument.
|
|
|
- * @param value is the value for that argument.
|
|
|
- * @return <code>"flag value"</code>
|
|
|
- */
|
|
|
- protected String buildArgument(CommandLineArgument argument, String value) {
|
|
|
- return argument.flag() + " " + value;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Creates a string for all arguments and their values that have been succesfully parsed.F
|
|
|
+ * 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.
|
|
|
*/
|
|
|
- private String parsedKeys(String... arguments) {
|
|
|
- var keys = namespace.getAttrs().keySet().stream()
|
|
|
- .filter(key -> key.equals(ROOT_DIRECTORY.flag()) || Arrays.stream(arguments).anyMatch(arg -> arg.contains(key)));
|
|
|
- return keys.map(it -> it + "=" + namespace.get(it)).collect(toSet()).toString();
|
|
|
+ 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!");
|
|
|
}
|
|
|
|
|
|
}
|