How do I compare dynamic object types in Junit for example:-
while (objList.hasNext()) {
Object<String> obj = objList.next();
Assert.assertEquals("expected", obj);
}
In this scenario if one occurrence is failed the whole test will fail. Is it a good approach if I use a condition before the assert test to pin point the expected String
like this:
while (objList.hasNext()) {
Object<String> obj = objList.next();
if (obj.equals("expected")) {
Assert.assertEquals("expected", obj);
}
}
but in this case there's no point of having a Junit assert test. Because I'm already doing what Junit is intended to do Thanks.