ComputationExceptionBuilder { public ComputationException build() { ComputationException exception; if (message != null && cause != null) { exception = new ComputationException(message, cause, outMsgByLogFileName, errMsgByLogFileName, bytesByFileName); } else if (message != null) { exception = new ComputationException(message, outMsgByLogFileName, errMsgByLogFileName, bytesByFileName); } else if (cause != null) { exception = new ComputationException(cause, outMsgByLogFileName, errMsgByLogFileName, bytesByFileName); } else { exception = new ComputationException(outMsgByLogFileName, errMsgByLogFileName, bytesByFileName); } return exception; } ComputationExceptionBuilder();  ComputationExceptionBuilder(Throwable cause); ComputationExceptionBuilder message(@Nullable String message); ComputationExceptionBuilder addOutLogIfExists(@Nullable Path path); ComputationExceptionBuilder addOutLog(String logName, @Nullable String log); ComputationExceptionBuilder addErrLogIfExists(@Nullable Path path); ComputationExceptionBuilder addErrLog(String logName, @Nullable String log); ComputationExceptionBuilder addFileIfExists(@Nullable Path path); ComputationExceptionBuilder addBytes(String key, byte[] bytes); ComputationException build();  }
@Test public void withCause() { Exception cause = new RuntimeException("oops"); ComputationException computationException = new ComputationExceptionBuilder(cause) .build(); assertThat(computationException) .hasCause(cause) .hasMessageContaining("oops") .hasMessageContaining("RuntimeException") .hasStackTraceContaining("Caused by") .hasStackTraceContaining("oops"); }