WiserAssertions.findFirstOrElseThrow() returns the found message

This commit is contained in:
Paul Campbell 2018-08-25 12:38:53 +01:00
parent 1d43956263
commit f6204d8c3f
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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<WiserMessage> predicate,
final Supplier<AssertionError> exceptionSupplier) {
messages.stream()
return messages.stream()
.filter(predicate)
.findFirst()
.orElseThrow(exceptionSupplier);