如果我有以下课程:
public class MyTest
{
@Test
public void testSomething()
{
Something myData = new Something();
testAccordingToData(myData);
}
@Test
public void testSomethingElse()
{
Something myOtherData = new Something("something else");
testAccordingToData(myOtherData);
}
private void testAccordingToData(Something someData)
{
assertTrue(somedata.someField);
assertEquals(someData.someField, someData.someOtherField);
//and various other assertions based on someData
}
}
断言会testAccordingToData()
正常工作,还是只能从带有注释的方法中调用断言@Test
?