嗨我正在尝试测试一个有异常的代码,但是当我尝试测试它时,它说预期的属性未定义为注释类型测试
package Lab1;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import junit.framework.Assert;
class MyMathTest {
MyMath m = new MyMath();
@Test
void testDiv() {
int actual = m.div(6, 2);
int expected = 3;
assertEquals(expected, actual);
}
/* the error is in the upcoming line*/
@Test (expected = IllegalArgumentException.class)
public void testDivException(){
m.div(5, 0);
}
}
Run Code Online (Sandbox Code Playgroud)
这是错误信息
对于注释类型测试,未定义预期属性