Cannot find symbol assertEquals

后端 未结 6 1610
庸人自扰
庸人自扰 2021-02-02 07:37

I\'m trying to write my first unit tests for a calculator, but NetBeans says it can\'t find the symbol assertEquals and annotation @Test.
Should i

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 08:06

    JUnit 5 Jupiter

    In JUnit 5 the package name has changed and the Assertions are at org.junit.jupiter.api.Assertions and Assumptions at org.junit.jupiter.api.Assumptions

    So you have to add the following static import:

    import static org.junit.jupiter.api.Assertions.*;
    

    See also http://junit.org/junit5/docs/current/user-guide/#writing-tests-assertions

提交回复
热议问题