@Beta public class Snapshotter extends Object
Snapshots are stored in a file in the configured SnapshotConfig.rootPath
with the same package structure as the specification class and grouped by the specification.
Modifier and Type | Class and Description |
---|---|
static class |
Snapshotter.PrefixSuffixWrapper |
class |
Snapshotter.Snapshot |
static class |
Snapshotter.Store |
static interface |
Snapshotter.Wrapper |
Constructor and Description |
---|
Snapshotter(Snapshotter.Store snapshotStore) |
Modifier and Type | Method and Description |
---|---|
Snapshotter.Snapshot |
assertThat(String value)
Specifies the
actual value. |
protected void |
deleteActual(String snapshotId) |
protected Snapshotter.Store |
getSnapshotStore() |
protected String |
loadSnapshot(String snapshotId) |
Snapshotter |
normalizedWith(Function<String,String> normalizer)
Declares a
Function for normalizing the reference value. |
protected void |
saveActual(String snapshotId,
String value) |
protected void |
saveSnapshot(String snapshotId,
String value) |
String |
toString() |
Snapshotter |
wrappedAs(Snapshotter.Wrapper wrapper)
Declares a
Snapshotter.Wrapper for wrapping and unwrapping of the reference value. |
public Snapshotter(Snapshotter.Store snapshotStore)
protected Snapshotter.Store getSnapshotStore()
protected void deleteActual(String snapshotId)
public Snapshotter wrappedAs(Snapshotter.Wrapper wrapper)
Snapshotter.Wrapper
for wrapping and unwrapping of the reference value.
It is suggested that users create subclasses of Snapshotter
with common wrapped types,
instead of using this method directly.
public Snapshotter normalizedWith(Function<String,String> normalizer)
Function
for normalizing the reference value.
The default normalization is line ending normalization.
public Snapshotter.Snapshot assertThat(String value)
actual
value.
Note: The value is normalized by the normalizer function, defaults to line ending normalization.
value
- the actual value for assertions