@Test
public void testThrowableContent() throws Exception {
// create hierarchy
final Exception e_pre = new Exception("e");
e_pre.fillInStackTrace();
final HandlerException he1_pre = new HandlerException(e_pre);
he1_pre.fillInStackTrace();
final RuntimeException re_pre = new RuntimeException("re", he1_pre);
re_pre.fillInStackTrace();
final SwitchYardException sye_pre = new SwitchYardException("sye", re_pre);
sye_pre.fillInStackTrace();
final HandlerException he2_pre = new HandlerException("he", sye_pre);
he2_pre.fillInStackTrace();
// create message
RemoteMessage msg = new RemoteMessage();
msg.setContent(he2_pre);
// serialize and deserialize
msg = serDeser(msg, RemoteMessage.class);
// get causes
final HandlerException he2_post = (HandlerException)msg.getContent();
final SwitchYardException sye_post = (SwitchYardException)he2_post.getCause();
final RuntimeException re_post = (RuntimeException)sye_post.getCause();
final HandlerException he1_post = (HandlerException)re_post.getCause();
final Exception e_post = (Exception)he1_post.getCause();
// test wrapper
Assert.assertEquals(he2_pre.isWrapper(), he2_post.isWrapper());
Assert.assertEquals(he1_pre.isWrapper(), he1_post.isWrapper());
// test messages
Assert.assertEquals(he2_pre.getMessage(), he2_post.getMessage());
Assert.assertEquals(sye_pre.getMessage(), sye_post.getMessage());
Assert.assertEquals(re_pre.getMessage(), re_post.getMessage());
Assert.assertEquals(he1_pre.getMessage(), he1_post.getMessage());
Assert.assertEquals(e_pre.getMessage(), e_post.getMessage());
// test stack traces
Assert.assertEquals(he2_pre.getStackTrace().length, he2_post.getStackTrace().length);
Assert.assertEquals(sye_pre.getStackTrace().length, sye_post.getStackTrace().length);
Assert.assertEquals(re_pre.getStackTrace().length, re_post.getStackTrace().length);
Assert.assertEquals(he1_pre.getStackTrace().length, he1_post.getStackTrace().length);
Assert.assertEquals(e_pre.getStackTrace().length, e_post.getStackTrace().length);
}