import static org.easymock.EasyMock.*; public class ExampleTest { private Example example = createMock(Example.class); @Test public void testDoSomethingWithAnyObject() { // Expect that the doSomething method will be called with an object of any class example.doSomething(anyObject()); // Replay the mock object replay(example); // Call the method that uses the mock object ExampleUser exampleUser = new ExampleUser(example); exampleUser.useExample(); // Verify that the method was called with an object of any class verify(example); } }In this example, we have a class called Example that has a method called doSomething(). We want to test that another class, ExampleUser, is calling this method with an object of any class. We create a mock object of Example using the EasyMock library, and then use the anyObject() method to create an expectation that the doSomething() method will be called with an object of any class. We then replay the mock object, call the method that uses the mock object, and then verify that the method was called with an object of any class. The org.easymock EasyMock library is a popular package used for mocking objects in unit testing.