diff options
Diffstat (limited to 'common/src')
| -rw-r--r-- | common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java index ccb0f21..3681400 100644 --- a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java +++ b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java @@ -26,12 +26,25 @@ public class CompoundTest extends Test implements Cloneable { return new Result(Result.Value.SUCCESS, "All sub-tests had the expected result."); }; + public final static Function<Test[], Result> EXPECT_ALL_SUCCESS = tests -> EXPECT_ALL.apply(Result.ExpectedValue.SUCCESS, tests); + public final static Function<Test[], Result> EXPECT_ALL_FAILURE = tests -> EXPECT_ALL.apply(Result.ExpectedValue.FAILURE, tests); + public final static Function<Test[], Result> EXPECT_ALL_ANY = tests -> EXPECT_ALL.apply(Result.ExpectedValue.ANY, tests); + public final static Consumer<Test[]> RUN_ALL = tests -> { for (Test t : tests) { t.run(); } }; + public final static Consumer<Test[]> RUN_ALL_IF_FIRST = tests -> { + tests[0].run(); + if (tests[0].getResult().getValue().equals(Result.Value.SUCCESS)) { + for (int i = 1; i < tests.length; i++) { + tests[i].run(); + } + } + }; + public final static Consumer<Test[]> RUN_GREEDY_ALL = tests -> { for (Test t : tests) { t.run(); |
