public class MyClass { public void myMethod(int[] myArray) { // code here } }
MyClass mockObj = EasyMock.createMock(MyClass.class); int[] expectedArray = {1, 2, 3}; mockObj.myMethod(EasyMock.aryEq(expectedArray)); EasyMock.replay(mockObj);In this example, we're telling EasyMock to expect a call to myMethod with an array that matches the contents of expectedArray, using the aryEq method. We then tell EasyMock to replay the mock object. This code will work with the org.easymock package.