title: Surefire maven plugin does not execute one of the tests
body: <p>I have a project with four packages. With three of them everything is fine. I have generated JUnit tests and they are executed during the build or while I am running mvn test command.<br />
  But my fourth package, containing just one class. I have created a JUnit test for it, but when I am running the build, Surefire does not see this test class. All other eight test classes are executed, but this one is ignored.<br />
  When I am trying to execute just this one test class explicitly using</p>
  <blockquote>
  <p>mvn -Dtest=com.company.dpt.prj.pkg.MySpecificClassTest test</p>
  </blockquote>
  <p>I am getting these messages</p>
  <pre><code>[INFO]
  [INFO] Results:
  [INFO]
  [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  16.058 s
  [INFO] Finished at: 2020-12-19T23:58:01-08:00
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project my-project-name: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  <p>I went through the test code line by line and couldn't find any reasons for such behavior.<br />
  I even deleted the test file and regenerated a very basic one. It is still not executed.<br />
  Has anyone encountered something similar? Any hint will be greatly appreciated, as I couldn't find any clues.
  I am using JUnit 4.11</p>
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;version&gt;4.11&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  <p>All tests were originally generated using Netbeans v.12 &quot;Tools-&gt;Create/Update Test&quot; and than edited to reflect methods functionality.
  However, all test but this one are working fine both in Netbeans GUI and CLI &quot;mvn test&quot;. This one is ignored. The purpose of method I want to test is to build HttpEntity for the REST API client. Here is the code of the test:</p>
  <pre><code>/**
   * Test of prepareRequest method, of class BatchServiceClient.
   * @throws java.net.URISyntaxException
   */
  @Test
  public void testPrepareRequest() throws URISyntaxException {
      System.out.println(&quot;prepareRequest&quot;);
      ObjectMapper mapper = Json.mapper();
      URL configFileUrl = this.getClass().getClassLoader().getResource(&quot;config_f.json&quot;);
      if (configFileUrl == null) {
          fail(&quot;Missing configuration file&quot;);
      } else {
          File configFile = new File(configFileUrl.toURI());
          BatchConfig config = BatchConfigLoader.loadConfig(configFile);
          assertNotNull(config);
          boolean validated = config.validate();
          assertTrue(validated);
          BatchServiceClient client = new BatchServiceClient(config, null, null, null, null, null, null);
          List&lt;Object&gt; requestData = Arrays.asList(&quot;16759408&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;The Home Depot&quot;, &quot;&quot;,
                  &quot;Baltimore&quot;, &quot;MD&quot;, &quot;&quot;, &quot;840&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, 10, &quot;&quot;,
                  true, true, &quot;merchantName&quot;, &quot;merchantName&quot;, &quot;merchantName&quot;);
          HttpEntity&lt;String&gt; request = client.prepareRequest(requestData);
          assertNotNull(request);
      }
  }
  </code></pre>
  <p>My problem is that it is not failing within the test code. I will be happy if it would, because I will be able to debug it than. It is just not executing.
  I tried to upgrade JUnit to v.4.13.1 and surefire maven plugin to v.3.0.0-M5 but it did not have any affect.</p>
  <p>I tried to run mvn with -e option and got the following stack trace, but it still did not give me any clues on why it is happening.</p>
  <pre><code>at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
  at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
  at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
  at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
  at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
  at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
  at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
  at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
  at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
  at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
  at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke (Method.java:564)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
  
  Caused by: org.apache.maven.plugin.MojoFailureException: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.)
      at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution (SurefireHelper.java:149)
      at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary (SurefirePlugin.java:364)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:1041)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:857)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
      at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
      at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
      at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
      at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
      at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke (Method.java:564)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
  </code></pre>