in maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java [1492:1606]
private void checkNonForkedThreads(String parallel) throws MojoExecutionException {
if ("suites".equals(parallel)) {
if (!(getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountSuites() > 0)) {
throw new MojoExecutionException(
"Use threadCount or threadCountSuites > 0 or useUnlimitedThreads=true for parallel='suites'");
}
setThreadCountClasses(0);
setThreadCountMethods(0);
} else if ("classes".equals(parallel)) {
if (!(getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountClasses() > 0)) {
throw new MojoExecutionException(
"Use threadCount or threadCountClasses > 0 or useUnlimitedThreads=true for parallel='classes'");
}
setThreadCountSuites(0);
setThreadCountMethods(0);
} else if ("methods".equals(parallel)) {
if (!(getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountMethods() > 0)) {
throw new MojoExecutionException(
"Use threadCount or threadCountMethods > 0 or useUnlimitedThreads=true for parallel='methods'");
}
setThreadCountSuites(0);
setThreadCountClasses(0);
} else if ("suitesAndClasses".equals(parallel)) {
if (!(getUseUnlimitedThreads()
|| onlyThreadCount()
|| getThreadCountSuites() > 0
&& getThreadCountClasses() > 0
&& getThreadCount() == 0
&& getThreadCountMethods() == 0
|| getThreadCount() > 0
&& getThreadCountSuites() > 0
&& getThreadCountClasses() > 0
&& getThreadCountMethods() == 0
|| getThreadCount() > 0
&& getThreadCountSuites() > 0
&& getThreadCount() > getThreadCountSuites()
&& getThreadCountClasses() == 0
&& getThreadCountMethods() == 0)) {
throw new MojoExecutionException("Use useUnlimitedThreads=true, "
+ "or only threadCount > 0, "
+ "or (threadCountSuites > 0 and threadCountClasses > 0), "
+ "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0) "
+ "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) "
+ "for parallel='suitesAndClasses' or 'both'");
}
setThreadCountMethods(0);
} else if ("suitesAndMethods".equals(parallel)) {
if (!(getUseUnlimitedThreads()
|| onlyThreadCount()
|| getThreadCountSuites() > 0
&& getThreadCountMethods() > 0
&& getThreadCount() == 0
&& getThreadCountClasses() == 0
|| getThreadCount() > 0
&& getThreadCountSuites() > 0
&& getThreadCountMethods() > 0
&& getThreadCountClasses() == 0
|| getThreadCount() > 0
&& getThreadCountSuites() > 0
&& getThreadCount() > getThreadCountSuites()
&& getThreadCountClasses() == 0
&& getThreadCountMethods() == 0)) {
throw new MojoExecutionException("Use useUnlimitedThreads=true, "
+ "or only threadCount > 0, "
+ "or (threadCountSuites > 0 and threadCountMethods > 0), "
+ "or (threadCount > 0 and threadCountSuites > 0 and threadCountMethods > 0), "
+ "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) "
+ "for parallel='suitesAndMethods'");
}
setThreadCountClasses(0);
} else if ("both".equals(parallel) || "classesAndMethods".equals(parallel)) {
if (!(getUseUnlimitedThreads()
|| onlyThreadCount()
|| getThreadCountClasses() > 0
&& getThreadCountMethods() > 0
&& getThreadCount() == 0
&& getThreadCountSuites() == 0
|| getThreadCount() > 0
&& getThreadCountClasses() > 0
&& getThreadCountMethods() > 0
&& getThreadCountSuites() == 0
|| getThreadCount() > 0
&& getThreadCountClasses() > 0
&& getThreadCount() > getThreadCountClasses()
&& getThreadCountSuites() == 0
&& getThreadCountMethods() == 0)) {
throw new MojoExecutionException("Use useUnlimitedThreads=true, "
+ "or only threadCount > 0, "
+ "or (threadCountClasses > 0 and threadCountMethods > 0), "
+ "or (threadCount > 0 and threadCountClasses > 0 and threadCountMethods > 0), "
+ "or (threadCount > 0 and threadCountClasses > 0 and threadCount > threadCountClasses) "
+ "for parallel='both' or parallel='classesAndMethods'");
}
setThreadCountSuites(0);
} else if ("all".equals(parallel)) {
if (!(getUseUnlimitedThreads()
|| onlyThreadCount()
|| getThreadCountSuites() > 0 && getThreadCountClasses() > 0 && getThreadCountMethods() > 0
|| getThreadCount() > 0
&& getThreadCountSuites() > 0
&& getThreadCountClasses() > 0
&& getThreadCountMethods() == 0
&& getThreadCount() > (getThreadCountSuites() + getThreadCountClasses()))) {
throw new MojoExecutionException("Use useUnlimitedThreads=true, "
+ "or only threadCount > 0, "
+ "or (threadCountSuites > 0 and threadCountClasses > 0 and threadCountMethods > 0), "
+ "or every thread-count is specified, "
+ "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0 "
+ "and threadCount > threadCountSuites + threadCountClasses) "
+ "for parallel='all'");
}
} else {
throw new MojoExecutionException("Illegal parallel='" + parallel + "'");
}
}