title: Cannot run tests intelliJ - Spring project - error: java.lang.NoSuchMethodError
body: <p>Im working on restful application. At the beginning I used TDD methodology. On the second stage I switch to the option: tests after implemented methods. But I cannot run a test. Type of error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;
  
      at org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry.loadTestEngines(ServiceLoaderTestEngineRegistry.java:30)
  
      at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:53)
  
      at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
  
      at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:49)
  
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
  
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
  
  Process finished with exit code 1
  
  Empty test suite.
  </code></pre>
  
  <p>POM file:</p>
  
  <pre><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 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.przemyslawostrouch&lt;/groupId&gt;
      &lt;artifactId&gt;weatherapp&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;weatherapp&lt;/name&gt;
      &lt;description&gt;Web project will aviation weather and Notam informations&lt;/description&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;1.5.4.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.assertj/assertj-core --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.assertj&lt;/groupId&gt;
              &lt;artifactId&gt;assertj-core&lt;/artifactId&gt;
              &lt;version&gt;1.2.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.opencsv&lt;/groupId&gt;
              &lt;artifactId&gt;opencsv&lt;/artifactId&gt;
              &lt;version&gt;3.9&lt;/version&gt;
          &lt;/dependency&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;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;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
              &lt;artifactId&gt;junit-jupiter-api&lt;/artifactId&gt;
              &lt;version&gt;RELEASE&lt;/version&gt;
          &lt;/dependency&gt;&lt;!-- https://mvnrepository.com/artifact/org.json/json --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.json&lt;/groupId&gt;
              &lt;artifactId&gt;json&lt;/artifactId&gt;
              &lt;version&gt;20170516&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
              &lt;version&gt;2.8.1&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.16.16&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/com.squareup.retrofit/retrofit --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.squareup.retrofit&lt;/groupId&gt;
              &lt;artifactId&gt;retrofit&lt;/artifactId&gt;
              &lt;version&gt;1.9.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-actuator&lt;/artifactId&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>Test class example:</p>
  
  <pre><code>    package com.przemyslawostrouch.parsers;
  
  import com.przemyslawostrouch.domain.Airport;
  import com.przemyslawostrouch.domain.City;
  import com.przemyslawostrouch.domain.CityAirportDistance;
  import com.przemyslawostrouch.logic.NearestAirport;
  import org.junit.jupiter.api.Test;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import static org.assertj.core.api.Assertions.assertThat;
  
  
  /**
   * Created by Przemek on 2017-06-24.
   */
  class NearestAirportTest {
  
      private NearestAirport nearestAirport;
      private City katowiceCity;
      private Airport katowiceAirport;
      private Airport frankfurtAirport;
      private Airport pulkovoAirport;
      private CityAirportDistance cityAirportDistance;
      private CityAirportDistance cityAirportDistance1;
      private CityAirportDistance cityAirportDistance2;
      private String searchedCityUpperCase;
  
      public void setup() {
  
  
          searchedCityUpperCase = "Katowice";
  
          nearestAirport = new NearestAirport();
  
          katowiceCity = City.builder()
                  .name("Katowice")
                  .latitude(50.26489189999999)
                  .longitude(19.0237815)
                  .build();
  
          katowiceAirport = Airport.builder()
                  .name("Muchowiec Airport")
                  .longitude(19.03420066833496)
                  .latitude(50.23809814453125)
                  .build();
  
          frankfurtAirport = Airport.builder()
                  .name("Frankfurt am Main International Airport")
                  .longitude(8.5705556)
                  .latitude(50.0333333)
                  .build();
  
          pulkovoAirport = Airport.builder()
                  .name("Pulkovo Airport")
                  .longitude(30.262500762939453)
                  .latitude(59.80030059814453)
                  .build();
  
          cityAirportDistance = CityAirportDistance.builder()
                  .airportName(katowiceAirport.getName())
                  .searchedCityName(searchedCityUpperCase)
                  .distanceBetweenSearchedCityAndAirport(1.6565764398773335)
                  .build();
  
          cityAirportDistance1 = CityAirportDistance.builder()
                  .airportName(frankfurtAirport.getName())
                  .searchedCityName(searchedCityUpperCase)
                  .distanceBetweenSearchedCityAndAirport(401.81041784523916)
                  .build();
  
          cityAirportDistance2 = CityAirportDistance.builder()
                  .airportName(pulkovoAirport.getName())
                  .searchedCityName(searchedCityUpperCase)
                  .distanceBetweenSearchedCityAndAirport(688.4011751978946)
                  .build();
      }
  
      @Test
      void isNearestAirportNotNull() {
          setup();
          assertThat(nearestAirport).isNotNull();
      }
  
      @Test
      void whenTypedCityReturnCityWithFirstLetterUpperCase() {
          setup();
          String searchedCity = "katowice";
          assertThat(nearestAirport.searchedCityToUpperCase(searchedCity)).isEqualTo("Katowice");
      }
  
  
      @Test
      void forGivenCityAndAerodromeCoordinatesReturnDistance() {
          setup();
          //City Gdansk
          City gdanskCity = City.builder()
                  .name("Gdansk")
                  .latitude(54.35202520000001)
                  .longitude(18.6466384)
                  .build();
          Airport gdanskAirport = Airport.builder()
                  .name("GdaÅ„sk Lech WaÅ‚Ä™sa Airport")
                  .latitude(54.377601623535156)
                  .longitude(18.46619987487793)
                  .build();
  
          assertThat(nearestAirport.calculateDistance(gdanskCity, gdanskAirport)).isEqualTo(6.491638306515884);
      }
  
      @Test
      void forGivenCityNameCalculateDistanceBetweenAllAirports() {
          setup();
          List&lt;Airport&gt; listOfAirportsForTest = new ArrayList&lt;&gt;();
  
          listOfAirportsForTest.add(katowiceAirport);
          listOfAirportsForTest.add(frankfurtAirport);
          listOfAirportsForTest.add(pulkovoAirport);
  
  
          assertThat(nearestAirport.calculateDistanceBetweenAllAirportsAndSelectedCity(listOfAirportsForTest, katowiceCity))
                  .contains(cityAirportDistance, cityAirportDistance1, cityAirportDistance2);
  
      }
  
      @Test
      void sortListDistancesAndReturnNearestAirport() {
          setup();
  
          List&lt;CityAirportDistance&gt; cityAirportDistancesListTest = new ArrayList&lt;&gt;();
  
  
          cityAirportDistancesListTest.add(cityAirportDistance);
          cityAirportDistancesListTest.add(cityAirportDistance1);
          cityAirportDistancesListTest.add(cityAirportDistance2);
  
          assertThat(nearestAirport.createListOfNearestAirports(katowiceCity)).contains(cityAirportDistancesListTest.get(0)
                  , cityAirportDistancesListTest.get(1)
                  , cityAirportDistancesListTest.get(2));
  
      }
  </code></pre>
  
  <p>I tried change dependencies, delete these tests and write another, it doesn't work.
  I have never met this error, cannot run any test in this project. I cannot find the solution of this problem on stack overflow and similar pages. if you need any addition information just ask, thanks for help</p>