Repository: apache/netbeans
Issue: Rerun failed tests button is not getting enabled

### Apache NetBeans version

Apache NetBeans 18

### What happened

I have noticed that when running unit tests, the button for reruning failed tests in Test Results never gets enabled. 

### How to reproduce

* Create Java with Maven project
* Add some unit tests that fail
* Run tests and check the button - should be enabled but it's not.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Manjaro Linux

### JDK

OpenJDK 11

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

I checked the source code and the problem seems to be in the condition
`rerunFailedButton.setEnabled(displayHandler.sessionFinished && 
                                     rerunHandler.enabled(RerunType.CUSTOM) &&
                                     !treePanel.getFailedTests().isEmpty());`
in netbeans/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java

RerunType.CUSTOM doesn't seem to be used anywhere thus the condition is always false. Using `RerunType.ALL` fixes the issue, but I am not sure if it has any side-effects, I haven't found any yet.

### Are you willing to submit a pull request?

Yes

Changed files:
java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java

diff --git a/java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java b/java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java
index 4cda2cca62..2c04b7406d 100644
--- a/java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java
+++ b/java/maven.junit/src/org/netbeans/modules/maven/junit/JUnitOutputListenerProvider.java
@@ -470,7 +470,9 @@ public class JUnitOutputListenerProvider implements OutputProcessor {
 					return usingSurefire28(config.getMavenProject());
 				    } else if (usingJUnit4(config.getMavenProject())) { //#214334
 					return usingSurefire2121(config.getMavenProject());
-				    }
+				    } else if (getJUnitVersion(config.getMavenProject()).equals("JUNIT5")){
+                                        return usingSurefire2220(config.getMavenProject());
+                                    }
 				}
 			    }
 			    return false;
@@ -505,7 +507,12 @@ public class JUnitOutputListenerProvider implements OutputProcessor {
     private boolean usingSurefire28(MavenProject prj) {
         String v = PluginPropertyUtils.getPluginVersion(prj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE);
         return v != null && new ComparableVersion(v).compareTo(new ComparableVersion("2.8")) >= 0;
-    } 
+    }
+
+    private boolean usingSurefire2220(MavenProject prj) {
+        String v = PluginPropertyUtils.getPluginVersion(prj, Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_SUREFIRE);
+        return v != null && new ComparableVersion(v).compareTo(new ComparableVersion("2.22.0")) >= 0;
+    }
     
      private boolean usingTestNG(MavenProject prj) {
         for (Artifact a : prj.getArtifacts()) {
@@ -528,6 +535,12 @@ public class JUnitOutputListenerProvider implements OutputProcessor {
                     return "JUNIT3"; //NOI18N
                 }
             }
+            if ("org.junit.jupiter".equals(a.getGroupId()) && "junit-jupiter-api".equals(a.getArtifactId())) {
+                String version = a.getVersion();
+                if (version != null && new ComparableVersion(version).compareTo(new ComparableVersion("5.0")) >= 0) {
+                    return "JUNIT5"; //NOI18N
+                }
+            }
         }
         return juVersion;
     }