MockFateBackend

Keeps everything it is given, for tests that want to check what robot code logged.

val time = TestTimeSource()
val registry = FateRegistry(time)
val mock = MockFateBackend().also(registry::register)

registry.table("Drive").log("left", 1.5)

assertEquals(listOf(1.5), mock.valuesAt("Drive/left"))

It is safe to log from several threads. The inspection methods return copies, which can be stale if logging is still running.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
data class Record(val path: String, val value: Any?, val timestamp: Long)

One logged value.

Properties

Link copied to clipboard

The paths that have an entry, in the order they were created.

Link copied to clipboard

Every value logged, in the order the backend received them.

Functions

Link copied to clipboard
fun clear(): <Error class: unknown class>

Forgets every logged value, keeping the entries.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun <T> entry(path: String, schema: FateSchema<T>): FateEntry<T>

Returns the entry for path, creating it if this backend has not seen the path.

Link copied to clipboard
fun schemaAt(path: String): FateSchema<*>?

The schema path was created with, or null if nothing has created it.

Link copied to clipboard
fun valuesAt(path: String): List<Any?>

The values logged to path, oldest first.