Cannot find symbol assertEquals

后端 未结 6 1598
庸人自扰
庸人自扰 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:02

    I am working on JUnit in java 8 environment, using jUnit4.12

    for me: compiler was not able to find the method assertEquals, even when I used
    import org.junit.Assert;

    So I changed
    assertEquals("addb", string);
    to
    Assert.assertEquals("addb", string);

    So if you are facing problem regarding assertEqual not recognized, then change it to Assert.assertEquals(,); it should solve your problem

提交回复
热议问题