Skip to content

Commit

Permalink
OperationResultAssert: added anySubResultMatches; hasMessage fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Feb 16, 2022
1 parent f87b432 commit d4d3890
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand Down Expand Up @@ -86,9 +86,16 @@ public OperationResultAssert anyLogEntryMatches(Predicate<String> entryPredicate
return this;
}

public OperationResultAssert anySubResultMatches(Predicate<OperationResult> resultPredicate) {
if (actual.getResultStream().noneMatch(resultPredicate)) {
failWithMessage("Found no subresult matching specified predicate");
}
return this;
}

/** Use after asserting success or failure to propagate the message from subresult(s). */
public OperationResultAssert hasMessage(String message) {
objects.assertEqual(info, actual, message);
objects.assertEqual(info, actual.getMessage(), message);
return this;
}

Expand Down

0 comments on commit d4d3890

Please sign in to comment.