File: fix-junit-provider-selection.patch

package info (click to toggle)
surefire 2.22.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,884 kB
  • sloc: java: 65,603; xml: 16,675; jsp: 5; sh: 3; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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

--- 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
@@ -1565,12 +1565,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() ) ) );
     }
 
     private static boolean isForkModeNever( String forkMode )