I'm using EasyMock to mock a class called "Tuple". The Tuple.getString(int i) method is supposed to return the String at position i in the tuple. If that field is not a String, it will give a runtime error.
In order for andReturn to work, I will have to cast the value to String like below:
expect(tuple.getString(i)).andReturn((String) json.get(list[i])).atLeastOnce();
which is not the desired behavior.
For example, if json.get(list[i]) is an integer, I want to give a runtime error instead of casting it to String.
Is there a way to get around this?
Thank you!