[SUREFIRE-580] sanity check
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/3eb6fa72 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/3eb6fa72 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/3eb6fa72 Branch: refs/heads/master Commit: 3eb6fa7259846ec514f943cbf0b16450efde56b0 Parents: 2a944f0 Author: Tibor17 <tibo...@lycos.com> Authored: Thu Sep 3 11:20:29 2015 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Sun Sep 6 22:58:00 2015 +0200 ---------------------------------------------------------------------- .../plugin/surefire/AbstractSurefireMojo.java | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/3eb6fa72/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java index f847604..e8f1f75 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java @@ -826,6 +826,7 @@ public abstract class AbstractSurefireMojo ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); + warnIfRerunClashes(); } return true; } @@ -2256,7 +2257,7 @@ public abstract class AbstractSurefireMojo } - void ensureWorkingDirectoryExists() + private void ensureWorkingDirectoryExists() throws MojoFailureException { if ( getWorkingDirectory() == null ) @@ -2286,7 +2287,7 @@ public abstract class AbstractSurefireMojo } } - void ensureParallelRunningCompatibility() + private void ensureParallelRunningCompatibility() throws MojoFailureException { if ( isMavenParallel() && isNotForking() ) @@ -2295,7 +2296,7 @@ public abstract class AbstractSurefireMojo } } - void ensureThreadCountWithPerThread() + private void ensureThreadCountWithPerThread() throws MojoFailureException { if ( ForkConfiguration.FORK_PERTHREAD.equals( getEffectiveForkMode() ) && getThreadCount() < 1 ) @@ -2304,7 +2305,7 @@ public abstract class AbstractSurefireMojo } } - void warnIfUselessUseSystemClassLoaderParameter() + private void warnIfUselessUseSystemClassLoaderParameter() { if ( isUseSystemClassLoader() && isNotForking() ) { @@ -2322,7 +2323,7 @@ public abstract class AbstractSurefireMojo return SurefireHelper.commandLineOptions( getSession(), getLog() ); } - void warnIfDefunctGroupsCombinations() + private void warnIfDefunctGroupsCombinations() throws MojoFailureException, MojoExecutionException { if ( isAnyGroupsSelected() ) @@ -2348,6 +2349,18 @@ public abstract class AbstractSurefireMojo } } + private void warnIfRerunClashes() + throws MojoFailureException + { + boolean isRerun = getRerunFailingTestsCount() > 0; + boolean isFailFast = getSkipAfterFailureCount() > 0; + if ( isRerun && isFailFast ) + { + throw new MojoFailureException( "Parameters [rerunFailingTestsCount, skipAfterFailureCount] " + + "should not be enabled together." ); + } + } + final class TestNgProviderInfo implements ProviderInfo {