Package au.com.origin.snapshots
Class Expect
java.lang.Object
au.com.origin.snapshots.Expect
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncomparator(SnapshotComparator comparator) Apply a custom comparator for this snapshotcomparator(String name) Apply a custom comparator for this snapshotAdd anything you like to the snapshot header.static Expectof(SnapshotVerifier snapshotVerifier, Method method) reporters(SnapshotReporter... reporters) Apply a list of custom reporters for this snapshot This will replace the default reporters defined in the configApply a list of custom reporters for this snapshot This will replace the default reporters defined in the configNormally a snapshot can be applied only once to a test method.serializer(SnapshotSerializer serializer) Apply a custom serializer for this snapshotserializer(Class<? extends SnapshotSerializer> serializer) Apply a custom serializer for this snapshot.serializer(String name) Apply a custom serializer for this snapshotvoidtoMatchSnapshot(Object object) Make an assertion on the given input parameters against what already exists
-
Constructor Details
-
Expect
public Expect()
-
-
Method Details
-
of
-
toMatchSnapshot
Make an assertion on the given input parameters against what already existsIf you were previously using varargs and see an error - you can fix the error using "toMatchSnapshotLegacy", however, a better approach is to use the ".scenario()" feature as future versions of this library will most likely remove the legacy implementation completely.
- Parameters:
object- snapshot object
-
scenario
Normally a snapshot can be applied only once to a test method.For Parameterized tests where the same method is executed multiple times you can supply the scenario() to overcome this restriction. Ensure each scenario is unique.
- Parameters:
scenario- - unique scenario description- Returns:
- Snapshot
-
serializer
Apply a custom serializer for this snapshot- Parameters:
serializer- your custom serializer- Returns:
- Snapshot
-
serializer
Apply a custom serializer for this snapshot- Parameters:
name- - the {name} attribute serializer.{name} from snapshot.properties- Returns:
- Snapshot
-
comparator
Apply a custom comparator for this snapshot- Parameters:
comparator- your custom comparator- Returns:
- Snapshot
-
comparator
Apply a custom comparator for this snapshot- Parameters:
name- the {name} attribute comparator.{name} from snapshot.properties- Returns:
- Snapshot
-
reporters
Apply a list of custom reporters for this snapshot This will replace the default reporters defined in the config- Parameters:
reporters- your custom reporters- Returns:
- Snapshot
-
reporters
Apply a list of custom reporters for this snapshot This will replace the default reporters defined in the config- Parameters:
name- the {name} attribute reporters.{name} from snapshot.properties- Returns:
- Snapshot
-
serializer
Apply a custom serializer for this snapshot.- Parameters:
serializer- your custom serializer- Returns:
- this
- See Also:
-
header
Add anything you like to the snapshot header.These custom headers can be used in serializers, comparators or reporters to change how they behave.
- Parameters:
key- keyvalue- value- Returns:
- Expect
-