title: java.lang.Exception: No runnable methods junit springboot2
body: <p>I am writing Junits for a springboot application. when i run the junit i am getting that there are no methods to run. below is the code
  junit:</p>
  
  <pre class="lang-java prettyprint-override"><code>    @RunWith(Suite.class)
      @SuiteClasses({ EmployeeServiceApplication.class })
      public class TestEmployeeService {
  
          @Mock
          EmployeeRepository empRepo;
  
          @Autowired
          EmployeeService service;
  
  
          @BeforeEach
          void setMockOutput() {
              HashSet&lt;EmployeeView&gt; empSet = new HashSet&lt;&gt;();
              empSet.add(new EmployeeView(1, "firstName", "lastName", "05/30/1986", "EE"));
              when(empRepo.getEmployeeList()).thenReturn(empSet);
          }
  
          @Test
          public void testGetEmployeeList() {
               Assert.notEmpty(service.getEmployeeList());
  
      }
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
          &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
          &lt;parent&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
              &lt;version&gt;2.2.1.RELEASE&lt;/version&gt;
              &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
          &lt;/parent&gt;
          &lt;groupId&gt;com.employeeService&lt;/groupId&gt;
          &lt;artifactId&gt;employeeService&lt;/artifactId&gt;
          &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;name&gt;employeeService&lt;/name&gt;
          &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
          &lt;properties&gt;
              &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;/properties&gt;
  
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;io.springfox&lt;/groupId&gt;
                  &lt;artifactId&gt;springfox-swagger2&lt;/artifactId&gt;
                  &lt;version&gt;2.4.0&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;io.springfox&lt;/groupId&gt;
                  &lt;artifactId&gt;springfox-swagger-ui&lt;/artifactId&gt;
                  &lt;version&gt;2.4.0&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
  
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
  
      &lt;/project&gt;
  </code></pre>
  
  <p>am i missing something ?
  i tried lot of options from stackoverflow and they didn't work. and below are the things that i have tried with 
  1. @SpringBootTest
  2. @mockRunner
  3. @SpringBootTest (classes)</p>
  
  <p>Stack Trace:</p>
  
  <pre><code>java.lang.Exception: No runnable methods
      at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
      at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128)
      at org.junit.runners.ParentRunner.validate(ParentRunner.java:416)
      at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:84)
      at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:65)
      at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101)
      at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87)
      at org.junit.runners.Suite.&lt;init&gt;(Suite.java:102)
      at org.junit.runners.Suite.&lt;init&gt;(Suite.java:70)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:107)
      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>
  
  <p>page imports:</p>
  
  <pre><code>package com.employeeService.employeeService.service;
  
  import static org.mockito.Mockito.when;
  
  import java.util.HashSet;
  
  import org.junit.jupiter.api.BeforeEach;
  import org.junit.jupiter.api.Test;
  import org.junit.runner.RunWith;
  import org.junit.runners.Suite;
  import org.junit.runners.Suite.SuiteClasses;
  import org.mockito.Mock;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.util.Assert;
  
  import com.employeeService.employeeService.EmployeeServiceApplication;
  import com.employeeService.employeeService.service.repository.EmployeeRepository;
  </code></pre>