Package de.skuzzle.test.snapshots
Interface SnapshotDsl.ChooseName
-
- All Superinterfaces:
SnapshotDsl.ChooseActual
- All Known Subinterfaces:
SnapshotDsl.Snapshot
- Enclosing interface:
- SnapshotDsl
@API(status=STABLE) public static interface SnapshotDsl.ChooseName extends SnapshotDsl.ChooseActual
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default SnapshotDsl.ChooseActualnamed(String snapshotName)Choose a name for the snapshot file.SnapshotDsl.ChooseActualnamedAccordingTo(SnapshotNaming namingStrategy)Choose a name for the snapshot file according to the given strategy.-
Methods inherited from interface de.skuzzle.test.snapshots.SnapshotDsl.ChooseActual
assertThat
-
-
-
-
Method Detail
-
named
default SnapshotDsl.ChooseActual named(String snapshotName)
Choose a name for the snapshot file. This overrides the default naming scheme of usingmethod name + consecutive number. Note that, when you specify the same name twice within test cases for the same snapshot directory, snapshots will be silently overridden and tests may subsequently fail.- Parameters:
snapshotName- The name of the snapshot to create.- Returns:
- Fluent API object for choosing the snapshot format. Do NOT assume it is the same object as 'this'!
-
namedAccordingTo
@API(status=EXPERIMENTAL, since="1.1.0") SnapshotDsl.ChooseActual namedAccordingTo(SnapshotNaming namingStrategy)Choose a name for the snapshot file according to the given strategy.The
SnapshotNaminginterface has some static methods with useful implementations. You can also easily implement the interface yourself.For example, in a parameterized test, snapshot can be named like this:
@ParameterizedTest @ValueSource(strings = { "a", "b" }) void someTest(String parameter, Snapshot snapshot) { snapshot.namedAccordingTo(SnapshotNaming.withParameters(parameter)) .assertThat(parameter) .asText() .matchesSnapshotText(); }- Parameters:
namingStrategy- The naming strategy to use.- Returns:
- Fluent API object for choosing the snapshot format. Do NOT assume it is the same object as 'this'!
- Since:
- 1.1.0
-
-