EasyMock Arguments
To mock objects, you need to know which methods are called with what parameters, so you can assert them.
For simple parameters like Strings or numbers, this is easy and you can record the value just by simply calling
the method:
IMyMock mock = myControl.createMock(IMyMock.class);
mock.doSomething("Foo"); // Point of interest
mock.replay();
// This will call IMyMock.doSomething("Bar")
// public void methodUnderTest() { myMock.doSomething("Bar"); }
classUnderTest.methodUnderTest();
// This will compare "Foo" with "Bar" and fail the test
mock.verify();
Here, mock.doSomething("Foo") will 1) record the method invocation of doSomething and 2) record the value "Foo"
for the first and only parameter.
For more complex parameter objects, or if you want to ease restrictions, you will probably want
to implement your own EasyMock IArgumentMatcher. In this case, the actual parameter within the unit test
source code does not matter and you can use null for them...