resetMocktailState function
void
resetMocktailState()
Reset the state of Mocktail, 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, resetMocktailState might be called at the end of setUp
,
or in tearDown
.
Implementation
void resetMocktailState() {
_defaultResponse = _voidResponse;
_whenInProgress = false;
_untilCalledInProgress = false;
_verificationInProgress = false;
_whenCall = null;
_untilCall = null;
_verifyCalls.clear();
_capturedArgs.clear();
_storedArgs.clear();
_storedNamedArgs.clear();
_defaultResponses.clear();
}