public void testForOnFailure_noCallbackProvided() throws Throwable {
   Answer<Object> answer = AnswerFactory.forOnFailure(new Exception());
   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 testForOnFailure() throws Throwable {
    Throwable throwable = new Exception();
    @SuppressWarnings("unchecked")
    AsyncCallback<Object> callback = EasyMock.createMock(AsyncCallback.class);
    callback.onFailure(throwable);
    EasyMock.replay(callback);

    Answer<Object> answer = AnswerFactory.forOnFailure(throwable);
    Object[] args = {14, "Hallo", callback};

    answer.answer(args);

    EasyMock.verify(callback);
  }