diff --git a/CHANGELOG b/CHANGELOG index ad820cc..92d18a7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ CHANGELOG * Bump kemitix-parent from 1.1.0 to 5.1.1 * Use kemitix-checkstyle-ruleset 4.1.1 * Don't throw generic exceptions +* WiserAssertions.findFirstOrElseThrow() returns the found message * [testing] Use a free port for test mail server * [testing] Bump mockito-core from 1.10.19 to 2.21.0 * [testing] Bump spring-context-support from 4.2.6.RELEASE to 5.0.8.RELEASE diff --git a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java index e8aa8d1..cbeb14a 100644 --- a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java +++ b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java @@ -120,11 +120,12 @@ public final class WiserAssertions { * * @param predicate the condition a message must match * @param exceptionSupplier the supplier of the exception + * @return the first WiserMessage */ - private void findFirstOrElseThrow( + private WiserMessage findFirstOrElseThrow( final Predicate predicate, final Supplier exceptionSupplier) { - messages.stream() + return messages.stream() .filter(predicate) .findFirst() .orElseThrow(exceptionSupplier);