Adds a new test to verify that a client SerializationException prevents a server invocation.
Review by: bruce (desk)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@4973 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java b/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
index bd37556..6387ab6 100644
--- a/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
@@ -17,6 +17,7 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
+import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.AnonymousClassInterface;
import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.Circle;
import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableClass;
@@ -176,6 +177,37 @@
});
}
+ public void testSerializationExceptionPreventsCall() {
+ final boolean serializationExceptionCaught[] = new boolean[1];
+ new Timer() {
+ @Override
+ public void run() {
+ assertTrue("serializationExceptionCaught was not true",
+ serializationExceptionCaught[0]);
+ finishTest();
+ }
+ }.schedule(TEST_DELAY / 2);
+ delayTestFinish(TEST_DELAY);
+
+ InheritanceTestServiceAsync service = getServiceAsync();
+ service.echo(new AnonymousClassInterface() {
+ public void foo() {
+ // purposely empty
+ }
+ }, new AsyncCallback() {
+ public void onFailure(Throwable caught) {
+ assertTrue(
+ "onFailure: got something other than a SerializationException",
+ caught instanceof SerializationException);
+ serializationExceptionCaught[0] = true;
+ }
+
+ public void onSuccess(Object result) {
+ fail("onSuccess: call should not have succeeded");
+ }
+ });
+ }
+
/**
* Tests that transient fields do not prevent serializability.
*/