ModelVersionMismatchInjector class

Simulates model version mismatch (e.g., expects v2 but loads v1).

This injector tests how the application handles version mismatches when loading models. It simulates:

  • Loading an older version (downgrade scenario)
  • Loading a newer version (upgrade scenario)
  • Complete version mismatch (incompatible versions)

The injector can also simulate version detection and fallback behavior.

Implemented types

Constructors

ModelVersionMismatchInjector({VersionMismatchType mismatchType = VersionMismatchType.olderVersion, String expectedVersion = '2.0.0', String actualVersion = '1.0.0', bool attemptFallback = false})
Creates a ModelVersionMismatchInjector.

Properties

actualVersion String
Actual version loaded (e.g., "1.0.0").
final
attemptFallback bool
Whether the app should attempt fallback to another version.
final
description String
Detailed description of what this injector simulates.
no setteroverride
errorMessage String?
The error message for the mismatch.
no setter
expectedVersion String
Expected version (e.g., "2.0.0").
final
hashCode int
The hash code for this object.
no setterinherited
injectionCount int
Number of times the injector has been applied.
no setter
mismatchDetected bool
Whether a version mismatch was detected.
no setter
mismatchType VersionMismatchType
Type of version mismatch to simulate.
final
name String
Short human-readable name shown in reports and logs.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type FaultType
The FaultType category this injector belongs to.
no setteroverride

Methods

applyTo(AIModelAdapter model) Future<void>
Applies the injector to a model adapter.
detectMismatch() bool
Detects if there is a version mismatch.
fallbackToVersion() Future<bool>
Simulates attempting to fallback to another version.
getStatus() String
Convenience method to get the status as a readable string.
inject() Future<void>
Activate the fault.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() Future<void>
Deactivate the fault and restore normal conditions.
override
toString() String
A string representation of this object.
inherited

Operators

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