开发者

Junit assertions

From a Table, I get list of String's and would like to check that when val!= "A" , a string "x" exist in the list of table :

for (int i = 0; i < NbRow; j++)
      {


        if (val[i] == "A")
        {
         assertFalse("");

        }
        else
        {

          list.add(myTable.getValue(j, 0)); 

          //need to check here the str开发者_如何学Going exists in the list using assertTrue ?

        }
      }  

      }

How do I check that string X exists using assertion ?


Perhaps something like

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"));


If the strings are in a List or Set then

assertTrue(list.contains("rohg")); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜