public void testForOnSuccess_noCallbackProvided() throws Throwable { Answer<Object> answer = AnswerFactory.forOnSuccess(42); Object[] args = {14, "Hallo"}; try { answer.answer(args); fail("should have thrown exception"); } catch (IllegalArgumentException expected) { assertEquals( "No com.google.gwt.user.client.rpc.AsyncCallback object as last argument provided", expected.getMessage()); } }
public void testForOnSuccess() throws Throwable { @SuppressWarnings("unchecked") AsyncCallback<Object> callback = EasyMock.createMock(AsyncCallback.class); callback.onSuccess(42); EasyMock.replay(callback); Answer<Object> answer = AnswerFactory.forOnSuccess(42); Object[] args = {14, "Hallo", callback}; answer.answer(args); EasyMock.verify(callback); }