我有一个带有另一个POJO变量的POJO类
class Rows
{
private List<RowName> rowName; //RowName is another POJO with String variables
//getter & setter
}
测试用例通过了,但是我不确定我是否在正确测试。
public class RowsTest
{
private final List<RowName> rowName = Mockito.mock(List.class);
private final Rows target = new Rows(rowName);
@Test
public void testGetMethods()
{
//then
Assert.assertEquals(rowName, target.getRowName());
}
}
答案 0 :(得分:0)
编写Mock测试时,您需要考虑“我锁定了什么功能,因此将来不会发生意外更改”
测试数据类只能确保Java将来不会破坏它,并且Java在下一版本的发布周期中已经对此进行了测试。
具有针对程序定制的测试逻辑,而不是所使用的库和语言。