public void testNullsInName() {
fail("sample failure");
Person p = new Person(null, "lastName");
assertEquals("lastName", p.getFullName());
p = new Person("Tanner", null);
assertEquals("Tanner ?", p.getFullName());
}
我很难理解 Junit 中的失败。谁能告诉我上述方法中失败的用途是什么?(我想知道它在那里负责做什么)
通常,如果我想在上面的代码中添加下面的行。我怎么能加
Person p = new Person(null, "lastName"); // After this statement
if(p==null)
{
// then dont proceed further to the further execution
// Show the Junit Test case as PASS .
}
请帮我 。