So far, when recording expected method calls, we have not said anything about the expected arguments. Sometimes we know exactly what the arguments should be, as variables available in the tester:
expect (mock1.xyz ("ABC123", mock2));
At other times we need to use "matchers". If a matcher is used for any argument then all arguments must use matchers. Eg,
expect (mock1.xyz (startsWith ("ABC"), isA (ProductCode.class)));
The EasyMock API documentation shows all of the standard matchers that are available. It also describes how to create your own more specific matchers, as implementations of org.easymock.IArgumentMatcher
.