我正在嘗試測(cè)試我正在使用 JUnit5 設(shè)計(jì)的庫(kù)。我已經(jīng)到了需要斷言某事為假的地步,但是每當(dāng)我嘗試使用assertFalse(...).我將 JUnit 5.2 與 Gradle 5.1.1 一起使用,并嘗試了適合我需要的 assertFalse() 方法簽名但無(wú)濟(jì)于事。這包括僅使用布爾條件、使用條件加消息、用于Assertions.assertFalse(...)刪除靜態(tài)導(dǎo)入等。我已經(jīng)能夠?qū)⒋a縮小到一個(gè)簡(jiǎn)單的測(cè)試。下面的代碼失?。篅Testvoid test(){ assertFalse(false);}我的進(jìn)口是:import org.junit.jupiter.api.Test;import static org.junit.jupiter.api.Assertions.assertEquals;import static org.junit.jupiter.api.Assertions.assertFalse;//plus some others from the libraryGradle 報(bào)錯(cuò):ProjectDir/FTC_Robot_API/TeamCode/src/test/java/org/firstinspires/ftc/teamcode/FTC_Library/Robot/RobotBaseTest.java:28: error: cannot access BooleanSupplier assertFalse(false); ^ class file for java.util.function.BooleanSupplier not found1 error我希望顯然是 boolean ( false) 的不是 BooleanSupplier,所以我對(duì)它為什么會(huì)給我這個(gè)錯(cuò)誤感到困惑。任何幫助表示贊賞
1 回答

動(dòng)漫人物
TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個(gè)贊
我在使用 IntelliJ 時(shí)遇到了同樣的問題。解決它
刪除 IntelliJ 項(xiàng)目文件(例如
.iml
和.idea
文件)關(guān)閉項(xiàng)目
從 IntelliJ 歡迎屏幕中選擇“導(dǎo)入項(xiàng)目”
選擇“來自現(xiàn)有資源的項(xiàng)目”
按照提示設(shè)置項(xiàng)目。有關(guān)更多信息,請(qǐng)參閱 IntelliJ 網(wǎng)站:jetbrains.com/help/idea/import-project-or-module-wizard.html
添加回答
舉報(bào)
0/150
提交
取消