WiserAssertions.findFirstOrElseThrow() returns the found message
This commit is contained in:
parent
1d43956263
commit
f6204d8c3f
2 changed files with 4 additions and 2 deletions
|
@ -8,6 +8,7 @@ CHANGELOG
|
||||||
* Bump kemitix-parent from 1.1.0 to 5.1.1
|
* Bump kemitix-parent from 1.1.0 to 5.1.1
|
||||||
* Use kemitix-checkstyle-ruleset 4.1.1
|
* Use kemitix-checkstyle-ruleset 4.1.1
|
||||||
* Don't throw generic exceptions
|
* Don't throw generic exceptions
|
||||||
|
* WiserAssertions.findFirstOrElseThrow() returns the found message
|
||||||
* [testing] Use a free port for test mail server
|
* [testing] Use a free port for test mail server
|
||||||
* [testing] Bump mockito-core from 1.10.19 to 2.21.0
|
* [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
|
* [testing] Bump spring-context-support from 4.2.6.RELEASE to 5.0.8.RELEASE
|
||||||
|
|
|
@ -120,11 +120,12 @@ public final class WiserAssertions {
|
||||||
*
|
*
|
||||||
* @param predicate the condition a message must match
|
* @param predicate the condition a message must match
|
||||||
* @param exceptionSupplier the supplier of the exception
|
* @param exceptionSupplier the supplier of the exception
|
||||||
|
* @return the first WiserMessage
|
||||||
*/
|
*/
|
||||||
private void findFirstOrElseThrow(
|
private WiserMessage findFirstOrElseThrow(
|
||||||
final Predicate<WiserMessage> predicate,
|
final Predicate<WiserMessage> predicate,
|
||||||
final Supplier<AssertionError> exceptionSupplier) {
|
final Supplier<AssertionError> exceptionSupplier) {
|
||||||
messages.stream()
|
return messages.stream()
|
||||||
.filter(predicate)
|
.filter(predicate)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(exceptionSupplier);
|
.orElseThrow(exceptionSupplier);
|
||||||
|
|
Loading…
Reference in a new issue