I need to test a method, eg:
public ObjRet foo(string input)
{
...
return objRet;
}
For the above method, one test case involves input = {null, " ", "", etc} which would return the same default object and there are other test cases
Do I need to have separate test cases for each input (even though I need to validate for same default object)
or can i do something like this,
@Test
void testing()
{
String[] inputs = {null, "", " "};
List<ObjRet> received = new List<ObjRet>();
for(string input : inputs)
received.add(foo(input));
for(ObjRet obj : received)
Assert.assertEquals(obj, default);
}
I just want to make sure that if its a good practice to use for loops for assertions