diff --git a/src/test/java/net/hostsharing/test/JpaAttempt.java b/src/test/java/net/hostsharing/test/JpaAttempt.java index 85202a4b..8f62c50f 100644 --- a/src/test/java/net/hostsharing/test/JpaAttempt.java +++ b/src/test/java/net/hostsharing/test/JpaAttempt.java @@ -133,19 +133,15 @@ public class JpaAttempt { } public JpaResult assumeSuccessful() { - assumeThat(exception).as(getSensibleMessage(exception)).isNull(); + assumeThat(exception).as(firstRootCauseMessageLineOf(exception)).isNull(); return this; } public JpaResult assertSuccessful() { - assertThat(exception).as(getSensibleMessage(exception)).isNull(); + assertThat(exception).as(firstRootCauseMessageLineOf(exception)).isNull(); return this; } - private String getSensibleMessage(final RuntimeException exception) { - return exception != null ? NestedExceptionUtils.getRootCause(exception).getMessage() : null; - } - private String firstRootCauseMessageLineOf(final RuntimeException exception) { final var rootCause = NestedExceptionUtils.getRootCause(exception); return Optional.ofNullable(rootCause)