AppResponse implements Result { @Override public Throwable getException() { return exception; } AppResponse();  AppResponse(Object result);  AppResponse(Throwable exception); @Override Object recreate(); @Override Object getValue(); @Override void setValue(Object value); @Override Throwable getException(); @Override void setException(Throwable e); @Override boolean hasException(); @Override @Deprecated Map<String, String> getAttachments(); @Override Map<String, Object> getObjectAttachments(); void setAttachments(Map<String, String> map); @Override void setObjectAttachments(Map<String, Object> map); void addAttachments(Map<String, String> map); @Override void addObjectAttachments(Map<String, Object> map); @Override String getAttachment(String key); @Override Object getObjectAttachment(String key); @Override String getAttachment(String key, String defaultValue); @Override Object getObjectAttachment(String key, Object defaultValue); @Override void setAttachment(String key, String value); @Override void setAttachment(String key, Object value); @Override void setObjectAttachment(String key, Object value); @Override Result whenCompleteWithContext(BiConsumer<Result, Throwable> fn); @Override CompletableFuture<U> thenApply(Function<Result, ? extends U> fn); @Override Result get(); @Override Result get(long timeout, TimeUnit unit); void clear(); @Override String toString();  }
@Test public void testAppResponseWithNormalException() { NullPointerException npe = new NullPointerException(); AppResponse appResponse = new AppResponse(npe); StackTraceElement[] stackTrace = appResponse.getException().getStackTrace(); Assertions.assertNotNull(stackTrace); Assertions.assertTrue(stackTrace.length > 1); }
@Test public void testAppResponseWithEmptyStackTraceException() { Throwable throwable = buildEmptyStackTraceException(); if (throwable == null) { return; } AppResponse appResponse = new AppResponse(throwable); StackTraceElement[] stackTrace = appResponse.getException().getStackTrace(); Assertions.assertNotNull(stackTrace); Assertions.assertEquals(0,stackTrace.length); }