[英]Junit assertions
從表中,我得到String的列表,並想檢查當val!=“ A”時,表列表中是否存在字符串“ x”:
for (int i = 0; i < NbRow; j++)
{
if (val[i] == "A")
{
assertFalse("");
}
else
{
list.add(myTable.getValue(j, 0));
//need to check here the string exists in the list using assertTrue ?
}
}
}
如何使用斷言檢查字符串X是否存在?
也許像
List<String> list = new ArrayList<String>();
for(int i=0;i<NB_Row;i++){
list.add(myTable.getValue(row,col))
}
Assert.assertTrue(list.contains("file2"));
如果字符串在列表或集合中,則
assertTrue(list.contains("rohg"));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.