Cannot find symbol assertEquals

后端 未结 6 1659
庸人自扰
庸人自扰 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 07:57

    I was having the same problem cannot resolve symbol Assert i have tried these solutions by adding the different import from the different answers.

    1. import org.junit.Assert;
    2. import static org.junit.Assert.*;
    3. import static org.junit.Assert.assertEquals;
    4. import static org.junit.jupiter.api.Assertions.*;
    5. import org.junit.Assert;

    but the solution that did the magic was just place the junit-4.12.jar in the app\lib ditectory and just build the project, and import like this

    import org.junit.Assert;
    

    you can download the junit-4.12.jar from here

提交回复
热议问题