Skip to content

Commit 5a8cb6f

Browse files
authored
Reset mocks regardless if test fails or succeeds (mockito#408)
Ignore the outcome, but reset the mocks regardless if the test failed or suceeeded. If not, tests run after a failed test may not start with a clean state, leading to confusing errors when stubbing.
1 parent d93a654 commit 5a8cb6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scalatest/src/main/scala/org/mockito/scalatest/ResetMocksAfterEachAsyncTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import org.scalatest.{ AsyncTestSuite, FutureOutcome }
1111
trait ResetMocksAfterEachAsyncTest extends AsyncTestSuite with ResetMocksAfterEachTestBase {
1212

1313
override def withFixture(test: NoArgAsyncTest): FutureOutcome =
14-
super.withFixture(test).onSucceededThen(resetAll())
14+
super.withFixture(test).onCompletedThen(_ => resetAll())
1515

1616
}

0 commit comments

Comments
 (0)