I am to using asserThat to verify properties of objects in an ArrayList.
I am able to use assertThat if none of the objects contains data to be tested but I am not able to figure how to use assertThat if only one of the objects contain data to be tested.
Sample Code:
public class dataNeeded {
String data;
String modifiedDate;
public String getData(){
return data;
}
......
}
public ArrayList<dataNeeded> returnsNeededData(){
...
}
List<dataNeeded> dataToBeTested = returnsNeededData();
dataToBeTested.forEach(data->assertThat(data.getData(), not(equalTo("No"))));
List<dataNeeded> dataToBeTested2 = returnsNeededData();
// I need to verify if one of the objects in this list has it's data as "No"
dataToBeTested.forEach(data->assertThat(data.getData(), ???);