public TestResult setThrowable(Throwable throwable) { this.throwable = throwable; this.exceptionProxy = ExceptionProxy.createForException(throwable); return this; }
public TestResult setThrowable(Throwable throwable) { this.throwable = throwable; this.exceptionProxy = ExceptionProxy.createForException(throwable); return this; }
public ExceptionProxy(Throwable throwable) { this.className = throwable.getClass().getName(); this.message = throwable.getMessage(); this.trace = throwable.getStackTrace(); this.causeProxy = ExceptionProxy.createForException(throwable.getCause()); this.original = throwable; }
public ExceptionProxy(Throwable throwable) { this.className = throwable.getClass().getName(); this.message = throwable.getMessage(); this.trace = throwable.getStackTrace(); this.causeProxy = ExceptionProxy.createForException(throwable.getCause()); this.original = throwable; }
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 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()); }
@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()); }
throw new RuntimeException("Test", new UnknownException(null)); } catch (Exception e) { proxy = ExceptionProxy.createForException(e);