title: Gradle doesn't run tests
body: <p>In my Gradle project I have a very simple JUnit test: </p>
  
  <pre><code>import org.junit.jupiter.api.Test
  import static org.junit.jupiter.api.Assertions.fail
  
  class ApiCallerTest {
  
      @Test
      void testSetApiKey() {
          fail();
      }
  }
  </code></pre>
  
  <p>When I run the test in IntelliJ, I get a list of tasks with the message that the build was successful. Eg.:</p>
  
  <pre><code>Testing started at 19:52 ...
  &gt; Task :cleanTest UP-TO-DATE
  &gt; Task :compileJava UP-TO-DATE
  &gt; Task :compileGroovy NO-SOURCE
  &gt; Task :processResources NO-SOURCE
  &gt; Task :classes UP-TO-DATE
  &gt; Task :compileTestJava NO-SOURCE
  &gt; Task :compileTestGroovy NO-SOURCE
  &gt; Task :processTestResources NO-SOURCE
  &gt; Task :testClasses UP-TO-DATE
  &gt; Task :test NO-SOURCE
  BUILD SUCCESSFUL in 0s
  </code></pre>
  
  <p>This should not happen since I am expecting the test to fail. I also get a message "Test events were not received".</p>
  
  <p>This is my gradle.build file:</p>
  
  <pre><code>plugins {
      id 'groovy'
      id 'java'
  }
  
  group 'com.ipdive'
  version '1.0-SNAPSHOT'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile 'org.codehaus.groovy:groovy-all:2.3.11'
      testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
  }
  </code></pre>
  
  <p>According to suggestions on the internet I tried adding this code to the gradle.build file.</p>
  
  <pre><code>test {
      useJUnitPlatform()
  }
  </code></pre>
  
  <p>But that didn't help. </p>
  
  <p>I also tried changing the Gradle setting to "Run tests using" -> "IntelliJ IDEA". When I run the test after this change, I get an error message:</p>
  
  <pre><code>Internal Error occurred.
  org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
      at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:189)
      at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:168)
      at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
      at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
      at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
      at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
  Caused by: org.junit.platform.commons.JUnitException: MethodSelector [className = 'ApiCallerTest', methodName = 'testSetApiKey', methodParameterTypes = ''] resolution failed
      at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)
      at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:102)
      at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:82)
      at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113)
      at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:45)
      at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69)
      at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:181)
      ... 6 more
  Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: ApiCallerTest
  ...
  ...
  </code></pre>
  
  <p>Can you please tell me what to do so I can run my unit-tests with Gradle?</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: Added screenshot of the project structure.</p>
  
  <p><a href="https://i.stack.imgur.com/U1DlF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U1DlF.png" alt="Project structure"></a></p>