Skip to content

Commit

Permalink
fix: skipping parsing command line in case of empty string or white s…
Browse files Browse the repository at this point in the history
…pace [hotfix]
  • Loading branch information
danglotb committed Mar 1, 2019
1 parent 95bd281 commit a9b14f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/main/java/eu/stamp_project/testrunner/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ public static TestResult runTests(String classpath, String[] fullQualifiedNameOf
ParserOptions.FLAG_fullQualifiedNameOfTestClassToRun,
String.join(ConstantsHelper.PATH_SEPARATOR, fullQualifiedNameOfTestClasses),
methodNames.length == 0 ? ""
: ParserOptions.FLAG_testMethodNamesToRun + ConstantsHelper.WHITE_SPACE
+ String.join(ConstantsHelper.PATH_SEPARATOR, methodNames),
: (ParserOptions.FLAG_testMethodNamesToRun + ConstantsHelper.WHITE_SPACE
+ String.join(ConstantsHelper.PATH_SEPARATOR, methodNames)),
EntryPoint.blackList.isEmpty() ? ""
: (ParserOptions.FLAG_blackList + ConstantsHelper.WHITE_SPACE
+ String.join(ConstantsHelper.PATH_SEPARATOR, EntryPoint.blackList)) });
+ String.join(ConstantsHelper.PATH_SEPARATOR, EntryPoint.blackList))
}
);
return EntryPoint.runTests(javaCommand);
}

Expand Down Expand Up @@ -264,10 +266,11 @@ public static Coverage runCoverage(String classpath, String targetProjectClasses
EntryPoint.JACOCO_RUNNER_QUALIFIED_NAME, ParserOptions.FLAG_pathToCompiledClassesOfTheProject,
targetProjectClasses, ParserOptions.FLAG_fullQualifiedNameOfTestClassToRun,
String.join(ConstantsHelper.PATH_SEPARATOR, fullQualifiedNameOfTestClasses),
methodNames.length == 0 ? "" : ParserOptions.FLAG_testMethodNamesToRun,
String.join(ConstantsHelper.PATH_SEPARATOR, methodNames),
EntryPoint.blackList.isEmpty() ? ""
: (ParserOptions.FLAG_blackList + ConstantsHelper.WHITE_SPACE
methodNames.length == 0 ? "" :
(ParserOptions.FLAG_testMethodNamesToRun + ConstantsHelper.WHITE_SPACE +
String.join(ConstantsHelper.PATH_SEPARATOR, methodNames)),
EntryPoint.blackList.isEmpty() ? "" :
(ParserOptions.FLAG_blackList + ConstantsHelper.WHITE_SPACE
+ String.join(ConstantsHelper.PATH_SEPARATOR, EntryPoint.blackList)),
EntryPoint.jUnit5Mode ? ParserOptions.FLAG_isJUnit5 : "" });
return EntryPoint.runCoverage(javaCommand);
Expand Down Expand Up @@ -351,8 +354,8 @@ public static CoveragePerTestMethod runCoveragePerTestMethods(String classpath,
EntryPoint.JACOCO_RUNNER_PER_TEST_QUALIFIED_NAME, ParserOptions.FLAG_pathToCompiledClassesOfTheProject,
targetProjectClasses, ParserOptions.FLAG_fullQualifiedNameOfTestClassToRun,
String.join(ConstantsHelper.PATH_SEPARATOR, fullQualifiedNameOfTestClasses),
methodNames.length == 0 ? "" : ParserOptions.FLAG_testMethodNamesToRun,
String.join(ConstantsHelper.PATH_SEPARATOR, methodNames),
methodNames.length == 0 ? "" : ParserOptions.FLAG_testMethodNamesToRun + ConstantsHelper.WHITE_SPACE +
String.join(ConstantsHelper.PATH_SEPARATOR, methodNames),
EntryPoint.blackList.isEmpty() ? ""
: (ParserOptions.FLAG_blackList + ConstantsHelper.WHITE_SPACE
+ String.join(ConstantsHelper.PATH_SEPARATOR, EntryPoint.blackList)),
Expand Down Expand Up @@ -429,7 +432,7 @@ private static void runGivenCommandLine(String commandLine) throws TimeoutExcept

/**
* This method redirect Process IO to given destination using pipes
*
*
* @param src
* process input stream
* @param dest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public static ParserOptions parse(String[] args) {
case FLAG_isJUnit5:
parserOptions.isJUnit5 = true;
break;
case " ":
case "":
break;
default:
System.err.println(String.format("[ERROR]: %s is not a supported command line options", args[i]));
usage();
Expand Down
Binary file not shown.

0 comments on commit a9b14f1

Please sign in to comment.