mockito library Null safety

Classes

Fake
A stand-in for another object which cannot be used except for specifically overridden methods. [...]
Mock
Extend or mixin this class to mark the implementation as a Mock. [...]
PostExpectation<T>
VerificationResult
Information about a stub call verification. [...]

Extensions

ListOfVerificationResult

Properties

any Null
An argument matcher that matches any argument passed in this argument position. [...]
read-only
captureAny Null
An argument matcher that matches any argument passed in this argument position, and captures the argument for later access with VerificationResult.captured. [...]
read-only
untilCalled → InvocationLoader
Returns a future Invocation that will complete upon the first occurrence of the given invocation. [...]
read-only
verify Verification
Verify that a method on a mock object was called with the given arguments. [...]
read-only
verifyInOrder → _InOrderVerification
Verifies that a list of methods on a mock object have been called with the given arguments. For example: [...]
read-only
verifyNever Verification
Verify that a method on a mock object was never called with the given arguments. [...]
read-only
when Expectation
Create a stub method response. [...]
read-only

Functions

anyNamed(String named) Null
An argument matcher that matches any named argument passed in for the parameter named named. [...]
argThat(Matcher matcher, {String? named}) Null
An argument matcher that matches an argument (named or positional) that matches matcher. When capturing a named argument, the name of the argument must be passed via named. [...]
captureAnyNamed(String named) Null
An argument matcher that matches any named argument passed in for the parameter named named, and captures the argument for later access with VerificationResult.captured. [...]
captureThat(Matcher matcher, {String? named}) Null
An argument matcher that matches an argument (named or positional) that matches matcher, and captures the argument for later access with VerificationResult.captured. When capturing a named argument, the name of the argument must be passed via named. [...]
clearInteractions(dynamic mock) → void
Clear the collected interactions with mock.
logInvocations(List<Mock> mocks) → void
Print all collected invocations of any mock methods of mocks.
named<T extends Mock>(T mock, {String? name, int? hashCode}) → T
@Deprecated('This function does not provide value; hashCode and toString() can be ' 'stubbed individually. This function may be deleted as early as Mockito ' '5.0.0')
reset(dynamic mock) → void
Clear stubs of, and collected interactions with mock.
resetMockitoState() → void
Reset the state of Mockito, typically for use between tests. [...]
throwOnMissingStub(Mock mock, {void exceptionBuilder(Invocation)?}) → void
Opt-into Mock throwing NoSuchMethodError for unimplemented methods. [...]
verifyNoMoreInteractions(dynamic mock) → void
verifyZeroInteractions(dynamic mock) → void

Typedefs

Answering<T> = T Function(Invocation realInvocation)
Expectation = PostExpectation<T> Function<T>(T x)
Verification = VerificationResult Function<T>(T matchingInvocations)

Exceptions / Errors

MissingStubError
An error which is thrown when no stub is found which matches the arguments of a real method call on a mock object.