FakeContext class final

Fake logic block context provided for testing convenience.

Records all inputs, outputs, and errors that states produce, allowing test assertions against them. Use StateLogic.createFakeContext to attach a fake context to a state under test.

Implemented types

Constructors

FakeContext()
Creates a new FakeContext.

Properties

errors Iterable<Object>
Errors that have been reported by the state under test.
no setter
hashCode int
The hash code for this object.
no setteroverride
inputs Iterable<Object>
Inputs that have been added by the state under test.
no setter
isStarted bool
Whether the logic block is currently running and can accept inputs.
no setteroverride
outputs Iterable<Object>
Outputs that have been produced by the state under test.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status LogicBlockStatus
The simulated logic block status. Defaults to LogicBlockStatus.started.
getter/setter pair
task Future<void>
A Future that completes when all tracked async operations have finished. Use this to await in-flight StatefulFuture work in tests.
no setter

Methods

addError(Object e) → void
Adds an error to the logic block. Errors are immediately processed by the logic block's LogicBlock.handleError callback.
override
get<TData extends Object>() → TData
Gets a value of type TData from the logic block's blackboard.
override
input<TInput extends Object>(TInput input) → void
Adds an input value to the logic block's internal input queue.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
output<TOutput extends Object>(TOutput output) → void
Produces a logic block output value.
override
reset() → void
Clears all recorded inputs, outputs, errors, and blackboard data.
set<TData extends Object>(TData data) → void
Sets a value of type TData in the fake blackboard.
toString() String
A string representation of this object.
inherited
trackFuture(Future<void> future) → void
Tracks a Future so that LogicBlock.task will not complete until future has finished.
override

Operators

operator ==(Object other) bool
The equality operator.
override