getbloc_test library

Classes

Expectation<T>
A captured method or property accessor -> a function that returns a value.
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.
MockController<E, S>
Extend or mixin this class to mark the implementation as a MockController.
MockInternalFinalCallback<T>
A mocked InternalFinalCallback
MockStateController<S>
Extend or mixin this class to mark the implementation as a MockStateController.
VerificationResult
Information about a stub call verification.
When<T>
Result of when which enables methods to be stubbed via

Extensions

ListOfVerificationResult on List<VerificationResult>
Returns the list of argument lists which were captured within verifyInOrder.
whenController on StateBase<T>
Create a stub controller's state response.

Properties

untilCalled Future<Invocation> Function<T>(T _())
Returns a future Invocation that will complete upon the first occurrence of the given invocation.
no setter
verify → _Verify
Verify that a method on a mock object was called with the given arguments.
no setter
verifyInOrder List<VerificationResult> Function<T>(List<T Function()> recordedInvocations)
Verifies that a list of methods on a mock object have been called with the given arguments. For example:
no setter
verifyNever → _Verify
Verify that a method on a mock object was never called with the given arguments.
no setter
when When<T> Function<T>(T x())
Create a stub method response.
no setter

Functions

any<T>({String? named, Matcher? that}) → T
An argument matcher that matches any argument passed in.
captureAny<T>({String? named, Matcher? that}) → T
An argument matcher that captures any argument passed in.
clearInteractions(dynamic mock) → void
Clear the collected interactions with mock.
internalControllerTest<C extends BaseController<State>, State>({required C build(), State seed()?, dynamic act(C controller)?, Duration? wait, int skip = 0, dynamic expect()?, dynamic verify(C controller)?, dynamic errors()?}) Future<void>
Internal testController runner which is only visible for testing. This should never be used directly -- please use testController instead.
logInvocations(List<Mock> mocks) → void
Print all collected invocations of any mock methods of mocks.
registerFallbackValue<T>(T value) → void
Allows any and captureAny to be used on parameters of type T.
reset(dynamic mock) → void
Clear stubs of, and collected interactions with mock.
resetMocktailState() → void
Reset the state of Mocktail, typically for use between tests.
testController<C extends BaseController<State>, State>(String description, {required C build(), State seed()?, dynamic act(C controller)?, Duration? wait, int skip = 0, dynamic expect()?, dynamic verify(C controller)?, dynamic errors()?}) → void
Creates a new controller-specific test case with the given description. testController will handle asserting that the controller emits the expected states (in order) after act is executed. testController also handles ensuring that no additional states are emitted by closing the controller stream before evaluating the expectation.
throwOnMissingStub(Mock mock, {void exceptionBuilder(Invocation)?}) → void
Opt-into Mock throwing NoSuchMethodError for unimplemented methods.
verifyNoMoreInteractions(dynamic mock) → void
Ensure no redundant invocations occur.
verifyZeroInteractions(dynamic mock) → void
Ensure interactions never happened on a mock.

Typedefs

Answer<T> = T Function(Invocation invocation)
Returns a value dependent on the details of an invocation.

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.