我用@BeforeEach的时候,说this.calculator is null,后来我改成了@Before,测试成功!
查阅资料,@Before 和@After 被 @BeforeEach 和@AfterEach给替代了. 还有一些其他的的注解也被替代了,我的JUnit应该是旧版本的吧
看JUnit的anno:
https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations
Sign in to make a reply
不器
我用@BeforeEach的时候,说this.calculator is null,后来我改成了@Before,测试成功!