@Test void ensureOriginalIsReplacedToGuaranteeSerializationAccrossClassLoaders() { final RuntimeException mapped = InvocationExceptionWrapper .toRuntimeException(new InvocationTargetException(new CustomException("custom for test"))); assertTrue(ComponentException.class.isInstance(mapped)); assertEquals("(" + CustomException.class.getName() + ") custom for test", mapped.getMessage()); assertTrue(ComponentException.class.isInstance(mapped.getCause())); assertEquals("(" + AnotherException.class.getName() + ") other", mapped.getCause().getMessage()); }
public static RuntimeException toRuntimeException(final InvocationTargetException e) { final Set<Throwable> visited = new HashSet<>(); visited.add(e.getTargetException()); return mapException(e.getTargetException(), visited); }
InvocationExceptionWrapper { public static RuntimeException toRuntimeException(final InvocationTargetException e) { final Set<Throwable> visited = new HashSet<>(); visited.add(e.getTargetException()); return mapException(e.getTargetException(), visited); } }
InvocationExceptionWrapper { public static RuntimeException toRuntimeException(final InvocationTargetException e) { final Set<Throwable> visited = new HashSet<>(); visited.add(e.getTargetException()); return mapException(e.getTargetException(), visited); }  }
InvocationExceptionWrapper { public static RuntimeException toRuntimeException(final InvocationTargetException e) { final Set<Throwable> visited = new HashSet<>(); visited.add(e.getTargetException()); return mapException(e.getTargetException(), visited); }  static RuntimeException toRuntimeException(final InvocationTargetException e); }
InvocationExceptionWrapper { public static RuntimeException toRuntimeException(final InvocationTargetException e) { final Set<Throwable> visited = new HashSet<>(); visited.add(e.getTargetException()); return mapException(e.getTargetException(), visited); }  static RuntimeException toRuntimeException(final InvocationTargetException e);  }