Skip to content

Commit

Permalink
add verification for failed test for TestExecutionListener type lis…
Browse files Browse the repository at this point in the history
…tener
  • Loading branch information
giurim committed May 11, 2022
1 parent 81e819f commit 2bd866e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/java/co/helmethair/scalatest/helper/TestHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ default void verifyTestStartReported(String testIdSuffix, TestExecutionListener
verifyTestStartReported(testIdSuffix, listener, atLeastOnce());
}

default void verifyTestFailReported(String testIdSuffix, TestExecutionListener listener) {
verifyTestFailReported(testIdSuffix, listener, atLeastOnce());
}

default void verifyTestStartNotReported(String testIdSuffix, TestExecutionListener listener) {
verifyTestStartReported(testIdSuffix, listener, never());
}
Expand All @@ -138,6 +142,11 @@ default void verifyTestStartReported(String testIdSuffix, TestExecutionListener
);
}

default void verifyTestFailReported(String testIdSuffix, TestExecutionListener listener, VerificationMode mode) {
verify(listener, mode).executionFinished(
argThat(a -> a.getUniqueId().endsWith(testIdSuffix)), argThat(a -> a.getStatus() == TestExecutionResult.Status.FAILED));
}

default void verifyTestFailReported(String testIdsuffix, TestEngineExecutionListener listener) {
verifyTestFailReportedWith(testIdsuffix, listener, null);
}
Expand Down

0 comments on commit 2bd866e

Please sign in to comment.