开发者

Junit assertions

开发者 https://www.devze.com 2023-04-05 14:29 出处:网络
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 :

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

精彩评论

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