public static void main(String[] args) throws Exception { Exception t = new RuntimeException(); String foo = "foo"; String fooMsg = "foo; nested exception is: \n\t" + t; test(new RemoteException(), null, null); test(new RemoteException(foo), foo, null); test(new RemoteException(foo, t), fooMsg, t); test(new ActivationException(), null, null); test(new ActivationException(foo), foo, null); test(new ActivationException(foo, t), fooMsg, t); test(new ServerCloneException(foo), foo, null); test(new ServerCloneException(foo, t), fooMsg, t); }
/** * Sets up the fixture, for example, open a network connection. This method * is called before a test is executed. */ @Override protected void setUp() { errorMessage = "Clone Error"; causeMessage = "Caused Exception"; cause = new ServerCloneException(causeMessage); }
/** * @tests java.rmi.server.ServerCloneException#ServerCloneException(String) */ public void test_Constructor_String() { ServerCloneException e = new ServerCloneException(errorMessage); assertEquals(errorMessage, e.getMessage()); assertNull(e.detail); try { e.initCause(e); fail("No expected IllegalStateException"); } catch (IllegalStateException exception) { // expected } }
public void assertDeserialized(Serializable initial, Serializable deserialized) { SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized); ServerCloneException initEx = (ServerCloneException) initial; ServerCloneException desrEx = (ServerCloneException) deserialized; assertEquals(initEx.getMessage(), desrEx.getMessage()); assertEquals(initEx.getCause().getMessage(), desrEx.getCause().getMessage()); }
/** * @tests java.rmi.server.ServerCloneException#ServerCloneException(String,Exception) */ public void test_Constructor_String_Exception() { ServerCloneException e = new ServerCloneException(errorMessage, cause); assertEquals(cause.getMessage(), e.getCause().getMessage()); assertEquals(cause.getMessage(), e.detail.getMessage()); }
/** * @tests serialization/deserialization. */ public void testSerializationSelf() throws Exception { SerializationTest.verifySelf(new ServerCloneException(errorMessage, cause), comparator); }
/** * @tests serialization/deserialization compatibility with RI. */ public void testSerializationCompatibility() throws Exception { SerializationTest.verifyGolden(this, new ServerCloneException(errorMessage, cause), comparator); }