{
private NEListTable table = null;
private TestHelper helper = null;
public void testShowNETable()
{
Mock_QueryCtrl ctrl = new Mock_QueryCtrl();
helper.setObjectField(table,"ctrl",ctrl); //将Mock对象注入table
table.ShowNETable();
assertTrue(table.getRowCount()>0);
}
private class Mock_QueryCtrl extends QueryCtrl
{
public List queryNEList()
{
List neList = new ArrayList();
//返回你需要的数据...
return neList;
}
}
}
文章来源于领测软件测试网 https://www.ltesting.net/