-
Notifications
You must be signed in to change notification settings - Fork 0
(计算机)Assert
Chen Xiaojie edited this page Dec 18, 2022
·
1 revision
英语词典是这样解释 Assert 的:[^1]
to say that something is certainly true 斷言;肯定地說
在Java中,我们常常使用 Assert 一词作为判断测试成功与否。
import static org.junit.Assert.*;
assertEquals(期待值,真实值);
上述代码可以翻译为: 「assert that 期待值 equals 真实值」,虽然这里也可以翻译成「断言这里的期待值与真实值相等」,但是从更真实的语境出发,不应该是断言,而应该是检查 (check) ,检查代码是否运行正常,不正常则报错。