mockito library

Classes

Fake
Extend or mixin this class to mark the implementation as a Fake. [...]
Mock
Extend or mixin this class to mark the implementation as a Mock. [...]
PostExpectation<T>
VerificationResult
Information about a stub call verification. [...]

Properties

any Null
An argument matcher that matches any argument passed in "this" position.
read-only
captureAny Null
An argument matcher that matches any argument passed in "this" position, and captures the argument for later access with captured.
read-only
untilCalled Future<Invocation> Function<T>(T _)
Returns a future Invocation that will complete upon the first occurrence of the given invocation. [...]
read-only
verify VerificationResult Function<T>(T matchingInvocations)
Verify that a method on a mock object was called with the given arguments. [...]
read-only
verifyInOrder → void Function<T>(List<T> recordedInvocations)
Verify that a list of methods on a mock object have been called with the given arguments. For example: [...]
read-only
verifyNever VerificationResult Function<T>(T matchingInvocations)
Verify that a method on a mock object was never called with the given arguments. [...]
read-only
when PostExpectation<T> Function<T>(T x)
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 that matches matcher.
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 captured.
captureThat(Matcher matcher, {String named}) Null
An argument matcher that matches an argument that matches matcher, and captures the argument for later access with captured.
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
Opt-into Mock throwing NoSuchMethodError for unimplemented methods. [...]
typed<T>(ArgMatcher matcher, {String named}) Null
@Deprecated('ArgMatchers no longer need to be wrapped in Mockito 3.0')
typedArgThat(Matcher matcher, {String named}) Null
@Deprecated('Replace with `argThat`')
typedCaptureThat(Matcher matcher, {String named}) Null
@Deprecated('Replace with `captureThat`')
verifyNoMoreInteractions(dynamic mock) → void
verifyZeroInteractions(dynamic mock) → void

Typedefs

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