Let's say we have a class that has many collaborators that needs to be
mocked. One nice feature would be to be able to do something like this in
the setup method:
tested = new MyClassToTest(); // MyClassToTest has many collaborators
Whitebox.setInternalStateFromContext(tested, this);
What setInternalStateFromContext will do is to go through all fields
defined in "this" (e.g. the test) and set them on tested. This means that
we don't need to do Whitebox.setInternalState(tested, myCollaborator1);,
.., Whitebox.setInternalState(tested, myCollaboratorN) when the
collaborators are defined in the test case already.
Original issue reported on code.google.com by johan.ha...@gmail.com on 3 Jul 2009 at 12:58
Original issue reported on code.google.com by
johan.ha...@gmail.com
on 3 Jul 2009 at 12:58