@API(status=STABLE)

Package de.skuzzle.test.snapshots

The main public snapshot-testing API.

Snapshot tests are enabled for a test class via EnableSnapshotTests. This will allow you to inject an instance of SnapshotDsl.Snapshot into any test method within said test class.

 @EnableSnapshotTests
 class SomethingSomethingTest {

     @Test
     void test_to_string_representation(Snapshot snapshot) throws Exception {
         Object actualTestResult = subject.codeUnterTest(...);
         snapshot.assertThat(actualTestResult)
             .asText()
             .matchesSnapshotText();
     }

     @Test
     void test_json_serialization(Snapshot snapshot) throws Exception {
         Object actualTestResult = subject.codeUnterTest(...);
         snapshot.assertThat(actualTestResult)
             .as(XmlSnapshot.xml)
             .matchesSnapshotStructure();
     }
 }
 
See Also:
EnableSnapshotTests, SnapshotDsl.Snapshot