Wednesday 15 May 2024

How to check Actual Value contains in Expected Value

public void verifyActualValuePresentInExpected(List<String> expectedValue, set<String> actualValue){

Boolean status = actualValue.stream().allMatch(expectedValue:: contains);

if(status){
Pass
} else {
Fail
List<String> extraValue = actualValue.stream().
filter(val-> ! expectedValue.contains(val)).
Collect(Collectors.toList());
System.out.println(extraValue);

List<String> missingValue = expectedValue.stream().
filter(val1-> ! actualValue.contains(val1)).
Collect(Collectors.toList());
System.out.println(missingValue);

}

No comments:

Post a Comment