surefire (2.10-4) fix-junit-provider-selection.patch

Summary

 maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

    
download this patch

Patch contents

Description: Surefire can't correctly detect the 4.x version of
 JUnit that is present in the Debian Maven Repository.
 .
 This patch corrects that - its safe to assume that its greater
 than 4.7 as sid contains 4.8.2. The JUnit4Provider should
 never get selected due to the way these two checks are combined.
Author: James Page <james.page@ubuntu.com>
Forwarded: not-needed

Index: surefire/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
===================================================================
--- surefire.orig/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java	2012-03-19 15:06:03.310108598 +0000
+++ surefire/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java	2012-03-26 09:34:20.549223250 +0100
@@ -311,12 +311,14 @@
 
     private boolean isJunit47Compatible( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.7,)" );
+        return ( dependencyResolver.isWithinVersionSpec( artifact, "[4.7,)" ) ||
+                 ( artifact != null && "4.x".equals( artifact.getVersion() ) ) );
     }
 
     private boolean isAnyJunit4( Artifact artifact )
     {
-        return dependencyResolver.isWithinVersionSpec( artifact, "[4.0,)" );
+        return ( dependencyResolver.isWithinVersionSpec( artifact, "[4.0,)" ) ||
+                 ( artifact != null && "4.x".equals( artifact.getVersion() ) ) );
     }
 
     boolean isForkModeNever()