### Question:
StackTrace extends Throwable { public static StackTrace from(Throwable original) { if (original == null) { return null; } if (original instanceof StackTrace) { return (StackTrace) original; } return new Builder() .setExceptionClass(original.getClass().getName()) .setToString(original.toString()) .setMessage(original.getMessage()) .setStackTrace(original.getStackTrace()) .setCause(original.getCause()) .setSuppressed(original.getSuppressed()) .build(); } private  StackTrace(String exceptionClass, String toString, String message, StackTrace cause); static StackTrace from(Throwable original); @Override synchronized Throwable fillInStackTrace(); String getExceptionClass(); @Override String toString();  }### Answer:
@Test public void has_same_message_as_original_exception() { Throwable original = new Throwable("original message"); StackTrace copy = StackTrace.from(original); assertThat(copy.getMessage(), is("original message")); }
@Test public void has_same_stack_trace_as_original_exception() { Throwable original = new Throwable("original message"); StackTrace copy = StackTrace.from(original); assertThat(copy.getStackTrace(), is(arrayContaining(original.getStackTrace()))); assertThat(Throwables.getStackTraceAsString(copy), is(Throwables.getStackTraceAsString(original))); }
@Test public void causes_are_also_copied_recursively() { Throwable original = new Throwable("original message", new Exception("the cause")); StackTrace copy = StackTrace.from(original); assertThat(copy.getCause(), is(instanceOf(StackTrace.class))); assertThat(copy.getCause().getMessage(), is("the cause")); }
@Test public void suppressed_exceptions_are_also_copied_recursively() { Throwable original = new Throwable("original message"); original.addSuppressed(new Exception("suppressed 1")); original.addSuppressed(new RuntimeException("suppressed 2")); StackTrace copy = StackTrace.from(original); Throwable[] suppressed = copy.getSuppressed(); assertThat(suppressed.length, is(2)); assertThat(suppressed[0], is(instanceOf(StackTrace.class))); assertThat(suppressed[0].getMessage(), is("suppressed 1")); assertThat(suppressed[1], is(instanceOf(StackTrace.class))); assertThat(suppressed[1].getMessage(), is("suppressed 2")); }