PersistenceTestHarness class

Per-test Hive CE temp-box harness (bug #833, remediation 1).

Call bootstrap from the test's setUp and teardown from its tearDown: every test gets a FRESH temp-directory box set and every test's boxes are closed and deleted afterwards — the lifecycle is per-test, never shared.

The harness also carries the corruption drill (seedCorruptedBox + openWithRecovery) and the registrar gate (registerAdapters / expectedTypeIds checked inside bootstrap).

Constructors

PersistenceTestHarness({required List<String> boxNames, void registerAdapters()?, Set<int> expectedTypeIds = const <int>{}})

Properties

boxNames → List<String>
The box names opened by bootstrap (lowercased by Hive internally).
final
expectedTypeIds → Set<int>
Adapter typeIds that MUST be registered for bootstrap to pass.
final
hashCode → int
The hash code for this object.
no setterinherited
isBootstrapped → bool
Whether bootstrap ran for the current lifecycle.
no setter
registerAdapters → void Function()?
Init-time adapter registration, run INSIDE the registrar gate.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tempDir → Directory
The per-test temp directory backing the box set.
no setter

Methods

bootstrap() → Future<void>
Fresh temp directory + registrar gate + box set. Call from setUp.
box<E>(String name) → Box<E>
The open box name from the per-test set.
boxPath(String name) → String
The path of name's box file INSIDE the per-test temp directory.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openWithRecovery<E>(String name) → Future<Box<E>>
The corruption drill: open name's pre-corrupted fixture through the recovery path (clear + re-fetch) and return the recovered, EMPTY box.
seedCorruptedBox(String name, {List<int>? bytes}) → void
Seed a PRE-CORRUPTED box fixture for name inside the temp directory (bug #833, remediation 3).
teardown() → Future<void>
Close the box set and destroy the temp directory. Call from tearDown.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited