[英]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.