resetMockitoState function

void resetMockitoState()

Reset the state of Mockito, typically for use between tests.

For example, when using the test package, mock methods may accumulate calls in a setUp method, making it hard to verify method calls that were made during an individual test. Or, there may be unverified calls from previous test cases that should not affect later test cases.

In these cases, resetMockitoState might be called at the end of setUp, or in tearDown.

This also clears all user-provided dummy builders.


void resetMockitoState() {
  _whenInProgress = false;
  _untilCalledInProgress = false;
  _verificationInProgress = false;
  _whenCall = null;
  _untilCall = null;