User { public void sendMessage(String message) { webService.sendMessages(this, Arrays.asList(message)); } User(WebService webService, int userId, String password); void login(final LoginInterface loginInterface); void logout(); void sendMessage(String message); void getMessages();  }
@Test public void customMatchers() throws Exception { User user = new User(mockWebService, USER_ID, PASSWORD); String expectedMessage = "Test message"; user.sendMessage(expectedMessage); verify(mockWebService).sendMessages(eq(user), listContains(expectedMessage)); verify(mockWebService).sendMessages(eq(user), listDoesNotContain("other message")); verify(mockWebService).sendMessages(eq(user), listOfSize(1)); }