/** * If the test failed, the exception that was thrown. It does not need to be * the root cause. */ public Throwable getThrowable() { if (throwable == null) { if (exceptionProxy != null) { throwable = exceptionProxy.createException(); } } return throwable; }
/** * If the test failed, the exception that was thrown. It does not need to be * the root cause. */ public Throwable getThrowable() { if (throwable == null) { if (exceptionProxy != null) { throwable = exceptionProxy.createException(); } } return throwable; }
/** * Returns the cause of the exception represented by this proxy * * @return The cause of this exception */ public Throwable getCause() { // lazy create cause if (cause == null) { if (causeProxy != null) { cause = causeProxy.createException(); } } return cause; }
/** * Returns the cause of the exception represented by this proxy * * @return The cause of this exception */ public Throwable getCause() { // lazy create cause if (cause == null) { if (causeProxy != null) { cause = causeProxy.createException(); } } return cause; }
Throwable cause = causeProxy.createException(); if (original instanceof InvocationTargetException) { SecurityActions.setFieldValue(InvocationTargetException.class, original, "target", cause);
Throwable cause = causeProxy.createException(); if (original instanceof InvocationTargetException) { SecurityActions.setFieldValue(InvocationTargetException.class, original, "target", cause);
private void proxy(Throwable throwable) throws Throwable { //printConstructors(throwable); throw ExceptionProxy.createForException(throwable).createException(); }
@Test public void shouldRecreateInvocationTargetExceptions() throws Exception { ExceptionProxy proxy = serialize(ExceptionProxy.createForException( new InvocationTargetException(new RuntimeException(new ClassNotFoundException())))); Throwable t = proxy.createException(); Assert.assertEquals(InvocationTargetException.class, t.getClass()); Assert.assertEquals(RuntimeException.class, t.getCause().getClass()); Assert.assertEquals(ClassNotFoundException.class, t.getCause().getCause().getClass()); }
@Test public void shouldSerializeNonDeSerializableExceptions() throws Exception { ExceptionProxy proxy = serialize(ExceptionProxy.createForException(new NonDeserializableExtension("Test"))); Throwable t = proxy.createException(); Assert.assertEquals(ArquillianProxyException.class, t.getClass()); Assert.assertTrue( "Verify Proxy message contain root exception of deserialization problem", t.getMessage().contains("NonDeserializableExtension")); Assert.assertTrue( "Verify Proxy message contain root cause of deserialization problem", t.getMessage().contains("Could not de-serialize")); Assert.assertEquals(UnsupportedOperationException.class, t.getCause().getClass()); }
@Test public void shouldSerializeNonSerializableExceptions() throws Exception { ExceptionProxy proxy = serialize(ExceptionProxy.createForException(new NonSerializableException())); Throwable t = proxy.createException(); Assert.assertEquals(ArquillianProxyException.class, t.getClass()); Assert.assertTrue( "Verify Proxy message contain root exception of serialization problem", t.getMessage().contains("java.io.NotSerializableException")); Assert.assertTrue( "Verify Proxy message contain root cause of serialization problem", t.getMessage().contains("BufferedInputStream")); Assert.assertEquals(UnsupportedOperationException.class, t.getCause().getClass()); }
readProxy.createException().printStackTrace();