關於SpringBoot使用Junit測試報錯:Exception in thread 「main」 java.lang.NoSuchMethodError: org.junit.platform.c

1、問題描述 SpringBoot在使用Junit時候報錯如下: 測試單元導入如下: 可以看到我們使用的是org.junit.jupiter.api.Test,而這個模塊是Junit5纔有的,並且Junit官網對這個模塊使用有一定的要求,也就是IDEA的版本必須要是2017.3及以後的。 而我的IDEA版本爲2017.2,因此,如果不想升級IDEA的參考下面解決採用Junit4進行單元測試。 2、
相關文章
相關標籤/搜索