无法运行测试intelliJ-Spring项目-错误:java.lang.NoSuchMethodError

无法运行测试intelliJ-Spring项目-错误:java.lang.NoSuchMethodError,java,spring,testing,intellij-idea,junit,Java,Spring,Testing,Intellij Idea,Junit,我正在开发restful应用程序。开始时,我使用了TDD方法。在第二阶段,我切换到选项:在实现方法之后进行测试。但是我不能运行测试。错误类型: Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader; at org.junit.platform.

我正在开发restful应用程序。开始时,我使用了TDD方法。在第二阶段,我切换到选项:在实现方法之后进行测试。但是我不能运行测试。错误类型:

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.
POM文件:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.przemyslawostrouch</groupId>
    <artifactId>weatherapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>weatherapp</name>
    <description>Web project will aviation weather and Notam informations</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>1.2.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>3.9</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>RELEASE</version>
        </dependency><!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20170516</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.1</version>
        </dependency>


        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.16</version>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.squareup.retrofit/retrofit -->
        <dependency>
            <groupId>com.squareup.retrofit</groupId>
            <artifactId>retrofit</artifactId>
            <version>1.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

4.0.0
com.przemyslawostrouch
weatherapp
0.0.1-快照
罐子
weatherapp
网络项目将提供航空天气和Notam信息
org.springframework.boot
spring启动程序父级
1.5.4.1发布
UTF-8
UTF-8
1.8
org.assertj
assertj核心
1.2.0
测试
com.opencsv
opencsv
3.9
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧起动试验
测试
朱尼特
朱尼特
4.12
测试
org.junit.jupiter
JUnitJupiter api
释放
org.json
json
20170516
org.apache.commons
公地io
1.3.2
com.google.code.gson
格森
2.8.1
org.projectlombok
龙目
1.16.16
假如
改装
改造
1.9.0
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
springbootmaven插件
测试类示例:

    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<Airport> listOfAirportsForTest = new ArrayList<>();

        listOfAirportsForTest.add(katowiceAirport);
        listOfAirportsForTest.add(frankfurtAirport);
        listOfAirportsForTest.add(pulkovoAirport);


        assertThat(nearestAirport.calculateDistanceBetweenAllAirportsAndSelectedCity(listOfAirportsForTest, katowiceCity))
                .contains(cityAirportDistance, cityAirportDistance1, cityAirportDistance2);

    }

    @Test
    void sortListDistancesAndReturnNearestAirport() {
        setup();

        List<CityAirportDistance> cityAirportDistancesListTest = new ArrayList<>();


        cityAirportDistancesListTest.add(cityAirportDistance);
        cityAirportDistancesListTest.add(cityAirportDistance1);
        cityAirportDistancesListTest.add(cityAirportDistance2);

        assertThat(nearestAirport.createListOfNearestAirports(katowiceCity)).contains(cityAirportDistancesListTest.get(0)
                , cityAirportDistancesListTest.get(1)
                , cityAirportDistancesListTest.get(2));

    }
package com.przemyslawostrouch.parsers;
导入com.przemyslawostrouch.domain.Airport;
导入com.przemyslawostrouch.domain.City;
导入com.przemyslawostrouch.domain.CityAirportDistance;
导入com.przemyslawostrouch.logic.NearestAirport;
导入org.junit.jupiter.api.Test;
导入java.util.ArrayList;
导入java.util.List;
导入静态org.assertj.core.api.Assertions.assertThat;
/**
*由Przemek于2017年6月24日创建。
*/
类近机场测试{
私人近机场近机场;
私人城市卡托维切城;
卡托维塞私人机场;
法兰克福私人机场;
普尔科沃机场私人机场;
私人城市机场距离城市机场距离;
私人城市机场距离城市机场距离1;
私人城市机场距离城市机场距离2;
私有字符串搜索CityUpperCase;
公共作废设置(){
searchedCityUpperCase=“Katowice”;
nearestAirport=新的nearestAirport();
katowiceCity=City.builder()
.名称(“卡托维兹”)
.纬度(50.264891899999)
.经度(19.0237815)
.build();
katowiceAirport=Airport.builder()
.名称(“Muchowic机场”)
.经度(19.03420066833496)
.纬度(50.23809814453125)
.build();
法兰克福机场=Airport.builder()
.名称(“法兰克福美茵国际机场”)
.经度(8.570556)
.纬度(50.0333333)
.build();
pulkovoirport=Airport.builder()
.名称(“普尔科沃机场”)
.经度(30.262500762939453)
.纬度(59.80030059814453)
.build();
cityAirportDistance=cityAirportDistance.builder()
.airportName(katowiceAirport.getName())
.searchedCityName(searchedCityUpperCase)
.搜索中心与Dairport之间的距离(1.6565764398773335)
.build();
CityAirportDistance 1=CityAirportDistance.builder()
.airportName(frankfurtAirport.getName())
.searchedCityName(searchedCityUpperCase)
.搜索中心和Dairport之间的距离(401.81041784523916)
.build();
CityAirportDistance 2=CityAirportDistance.builder()
.airportName(pulkovoAirport.getName())
.searchedCityName(searchedCityUpperCase)
.搜索中心与Dairport之间的距离(688.401751978946)
.build();
}
@试验
void isNearestAirportNotNull(){
设置();
assertThat(nearestAirport).isNotNull();
}
@试验
void whenTypedCityReturnCityWithFirstLetterUpperCase(){
设置();
字符串searchedCity=“katowice”;
资产(nearestAirport.searchedCity大写(searchedCity)).isEqualTo(“Katowice”);
}
@试验
无效容差和航空里程坐标恢复距离(){
设置();
//格但斯克市
City-gdanskCity=City.builder()
.名称(“格但斯克”)
.纬度(54.3520252000001)
.经度(18.6466384)
.build();
Airport-gdanskAirport=Airport.builder()
.名称(“GdaÅsk Lech WaÅÅÅÅÅÅÅ”™南非机场)
.纬度(54.377601623535156)
.经度(18.46619987487793)
.build();
资产(靠近机场。计算站(格但斯克市,格但斯凯尔波特)).isEqualTo(6.491638306515884);
}
@试验
无效宽恕名称所有机场之间的计算持续时间(){
设置();
List-listOfAirportsForTest=new-ArrayList();
航空港列表。添加(卡托维塞机场);
机场名单(法兰克福机场);
航空港口列表。添加(pulkovoAirport);
资产(位于机场附近。计算所有机场和选定城市之间的距离(机场列表,katowiceCity))
.contains(城市航空)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:43)
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>RELEASE</version>
    </dependency>