From f6204d8c3f7655923db7fb2e5c7de714ebc4c824 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 25 Aug 2018 12:38:53 +0100 Subject: [PATCH] WiserAssertions.findFirstOrElseThrow() returns the found message --- CHANGELOG | 1 + .../java/net/kemitix/wiser/assertions/WiserAssertions.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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);