@Test(timeout=10000)
public void testSerializedExceptionDeSer() throws Exception{
// without cause
YarnException yarnEx = new YarnException("Yarn_Exception");
SerializedException serEx = SerializedException.newInstance(yarnEx);
Throwable throwable = serEx.deSerialize();
Assert.assertEquals(yarnEx.getClass(), throwable.getClass());
Assert.assertEquals(yarnEx.getMessage(), throwable.getMessage());
// with cause
IOException ioe = new IOException("Test_IOException");
RuntimeException runtimeException =
new RuntimeException("Test_RuntimeException", ioe);
YarnException yarnEx2 =
new YarnException("Test_YarnException", runtimeException);
SerializedException serEx2 = SerializedException.newInstance(yarnEx2);
Throwable throwable2 = serEx2.deSerialize();
throwable2.printStackTrace();
Assert.assertEquals(yarnEx2.getClass(), throwable2.getClass());
Assert.assertEquals(yarnEx2.getMessage(), throwable2.getMessage());
Assert.assertEquals(runtimeException.getClass(), throwable2.getCause().getClass());