enrichment schema 2

This commit is contained in:
2026-06-13 07:33:30 +02:00
parent 8641c7266f
commit f85a68d9fc
12 changed files with 675 additions and 67 deletions

View File

@@ -0,0 +1,165 @@
package click.kamil.springstatemachineexporter;
import click.kamil.springstatemachineexporter.analysis.service.EnrichmentService;
import click.kamil.springstatemachineexporter.exporter.Dot;
import click.kamil.springstatemachineexporter.exporter.JsonExporter;
import click.kamil.springstatemachineexporter.exporter.PlantUml;
import click.kamil.springstatemachineexporter.exporter.Scxml;
import click.kamil.springstatemachineexporter.exporter.StateMachineExporter;
import click.kamil.springstatemachineexporter.service.ExportService;
import click.kamil.springstatemachineexporter.utils.TestScenario;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
public class GoldenUpdater {
private static final List<StateMachineExporter> exporters = List.of(new PlantUml(), new Dot(), new Scxml(), new JsonExporter());
private static final EnrichmentService enrichmentService = new EnrichmentService(Collections.emptyList());
private static final ExportService exportService = new ExportService(exporters, enrichmentService);
public static void main(String[] args) throws Exception {
List<TestScenario> scenarios = provideTestScenarios();
Path rootDir = Path.of("state_machine_exporter");
for (TestScenario scenario : scenarios) {
System.out.println("Updating golden files for: " + scenario.name());
Path tempDir = Files.createTempDirectory("golden-update-");
try {
exportService.runExporter(scenario.inputPath(), tempDir, null, true);
List<Path> generatedDirs;
try (var stream = Files.list(tempDir)) {
generatedDirs = stream.filter(Files::isDirectory).toList();
}
String targetBaseName = scenario.baseName();
Path actualDir = generatedDirs.stream()
.filter(d -> d.getFileName().toString().endsWith(targetBaseName))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No output directory found for " + targetBaseName));
String actualBaseName = actualDir.getFileName().toString();
Path goldenDirPath = rootDir.resolve(scenario.goldenPath());
Files.createDirectories(goldenDirPath);
for (StateMachineExporter exporter : exporters) {
String fileName = actualBaseName + exporter.getFileExtension();
String goldenFileName = targetBaseName + exporter.getFileExtension();
Path actualFile = actualDir.resolve(fileName);
Path goldenFile = goldenDirPath.resolve(goldenFileName);
System.out.println(" Writing " + goldenFile);
Files.copy(actualFile, goldenFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
// Special case for PlantUML: also generate PNG
if (exporter instanceof PlantUml) {
String pngFileName = targetBaseName + ".png";
Path goldenPngFile = goldenDirPath.resolve(pngFileName);
System.out.println(" Rendering " + goldenPngFile);
String pumlContent = Files.readString(actualFile);
SourceStringReader reader = new SourceStringReader(pumlContent);
ByteArrayOutputStream os = new ByteArrayOutputStream();
reader.outputImage(os, new FileFormatOption(FileFormat.PNG));
Files.write(goldenPngFile, os.toByteArray());
}
}
} finally {
// delete tempDir
deleteDirectory(tempDir);
}
}
}
private static void deleteDirectory(Path path) throws IOException {
if (Files.isDirectory(path)) {
try (var stream = Files.list(path)) {
for (Path p : stream.toList()) {
deleteDirectory(p);
}
}
}
Files.delete(path);
}
private static List<TestScenario> provideTestScenarios() {
return List.of(
new TestScenario(
"Complex State Machine",
Path.of("state_machines/complex_state_machine"),
Path.of("src/test/resources/golden/ComplexStateMachineConfig"),
"ComplexStateMachineConfig"
),
new TestScenario(
"Fork Join State Machine",
Path.of("state_machines/forkjoin_state_machine"),
Path.of("src/test/resources/golden/ForkJoinStateMachineConfig"),
"ForkJoinStateMachineConfig"
),
new TestScenario(
"Kamil Enum State Machine",
Path.of("state_machines/enumstate_state_machine"),
Path.of("src/test/resources/golden/KamilEnumStateMachineConfiguration"),
"KamilEnumStateMachineConfiguration"
),
new TestScenario(
"Simple Enum Join State Machine",
Path.of("state_machines/simple_state_machine"),
Path.of("src/test/resources/golden/SimpleEnumStateMachineConfiguration"),
"SimpleEnumStateMachineConfiguration"
),
new TestScenario(
"One State Machine (Inheritance)",
Path.of("state_machines/inheritance_state_machine"),
Path.of("src/test/resources/golden/OneStateMachineConfiguration"),
"OneStateMachineConfiguration"
),
new TestScenario(
"Two State Machine (Extra Functions)",
Path.of("state_machines/inheritance_extra_functions_state_machine"),
Path.of("src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration"),
"TwoStateMachineConfiguration"
),
new TestScenario(
"Three State Machine (Extra Functions 2)",
Path.of("state_machines/inheritance_extra_functions2_state_machine"),
Path.of("src/test/resources/golden/ThreeStateMachineConfiguration"),
"ThreeStateMachineConfiguration"
),
new TestScenario(
"F1 State Machine (Example 4)",
Path.of("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F1StateMachineConfiguration"),
"F1StateMachineConfiguration"
),
new TestScenario(
"F2 State Machine (Example 4)",
Path.of("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F2StateMachineConfiguration"),
"F2StateMachineConfiguration"
),
new TestScenario(
"G1 State Machine (Example 4)",
Path.of("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G1StateMachineConfiguration"),
"G1StateMachineConfiguration"
),
new TestScenario(
"G2 State Machine (Example 4)",
Path.of("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G2StateMachineConfiguration"),
"G2StateMachineConfiguration"
)
);
}
}

View File

@@ -0,0 +1,162 @@
package click.kamil.springstatemachineexporter;
import click.kamil.springstatemachineexporter.analysis.service.EnrichmentService;
import click.kamil.springstatemachineexporter.exporter.PlantUml;
import click.kamil.springstatemachineexporter.exporter.StateMachineExporter;
import click.kamil.springstatemachineexporter.service.ExportService;
import click.kamil.springstatemachineexporter.utils.TestScenario;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SourceStringReader;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@Tag("e2e")
@Tag("plantuml")
@Tag("png")
public class PlantUmlE2ETest {
private final List<StateMachineExporter> exporters = List.of(new PlantUml());
private final EnrichmentService enrichmentService = new EnrichmentService(Collections.emptyList());
private final ExportService exportService = new ExportService(exporters, enrichmentService);
private static Path findProjectRoot() {
Path current = Path.of(".").toAbsolutePath();
while (current != null && !Files.exists(current.resolve("settings.gradle"))) {
current = current.getParent();
}
return current;
}
private static List<TestScenario> provideTestScenarios() {
Path root = findProjectRoot();
return List.of(
new TestScenario(
"Complex State Machine",
root.resolve("state_machines/complex_state_machine"),
Path.of("src/test/resources/golden/ComplexStateMachineConfig"),
"ComplexStateMachineConfig"
),
new TestScenario(
"Fork Join State Machine",
root.resolve("state_machines/forkjoin_state_machine"),
Path.of("src/test/resources/golden/ForkJoinStateMachineConfig"),
"ForkJoinStateMachineConfig"
),
new TestScenario(
"Kamil Enum State Machine",
root.resolve("state_machines/enumstate_state_machine"),
Path.of("src/test/resources/golden/KamilEnumStateMachineConfiguration"),
"KamilEnumStateMachineConfiguration"
),
new TestScenario(
"Simple Enum Join State Machine",
root.resolve("state_machines/simple_state_machine"),
Path.of("src/test/resources/golden/SimpleEnumStateMachineConfiguration"),
"SimpleEnumStateMachineConfiguration"
),
new TestScenario(
"One State Machine (Inheritance)",
root.resolve("state_machines/inheritance_state_machine"),
Path.of("src/test/resources/golden/OneStateMachineConfiguration"),
"OneStateMachineConfiguration"
),
new TestScenario(
"Two State Machine (Extra Functions)",
root.resolve("state_machines/inheritance_extra_functions_state_machine"),
Path.of("src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration"),
"TwoStateMachineConfiguration"
),
new TestScenario(
"Three State Machine (Extra Functions 2)",
root.resolve("state_machines/inheritance_extra_functions2_state_machine"),
Path.of("src/test/resources/golden/ThreeStateMachineConfiguration"),
"ThreeStateMachineConfiguration"
),
new TestScenario(
"F1 State Machine (Example 4)",
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F1StateMachineConfiguration"),
"F1StateMachineConfiguration"
),
new TestScenario(
"F2 State Machine (Example 4)",
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F2StateMachineConfiguration"),
"F2StateMachineConfiguration"
),
new TestScenario(
"G1 State Machine (Example 4)",
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G1StateMachineConfiguration"),
"G1StateMachineConfiguration"
),
new TestScenario(
"G2 State Machine (Example 4)",
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G2StateMachineConfiguration"),
"G2StateMachineConfiguration"
)
);
}
@ParameterizedTest(name = "{0}")
@MethodSource("provideTestScenarios")
void testPngGenerationMatchesGolden(TestScenario scenario, @TempDir Path tempDir) throws Exception {
// 1. Generate PUML
exportService.runExporter(scenario.inputPath(), tempDir, List.of("puml"), true);
List<Path> generatedDirs;
try (var stream = Files.list(tempDir)) {
generatedDirs = stream.filter(Files::isDirectory).toList();
}
String targetBaseName = scenario.baseName();
Path actualDir = generatedDirs.stream()
.filter(d -> d.getFileName().toString().endsWith(targetBaseName))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No output directory found for " + targetBaseName));
String actualBaseName = actualDir.getFileName().toString();
Path pumlFile = actualDir.resolve(actualBaseName + ".puml");
assertThat(pumlFile).exists();
// 2. Render PNG using PlantUML library
String pumlContent = Files.readString(pumlFile);
SourceStringReader reader = new SourceStringReader(pumlContent);
ByteArrayOutputStream os = new ByteArrayOutputStream();
reader.outputImage(os, new FileFormatOption(FileFormat.PNG));
byte[] actualPngBytes = os.toByteArray();
// 3. Compare with Golden
Path goldenPngFile = scenario.goldenPath().resolve(targetBaseName + ".png");
if (Boolean.getBoolean("updateGolden")) {
Files.createDirectories(goldenPngFile.getParent());
Files.write(goldenPngFile, actualPngBytes);
System.out.println("Updated golden PNG: " + goldenPngFile);
} else {
assertThat(goldenPngFile)
.as("Golden PNG file %s should exist", goldenPngFile)
.exists();
byte[] expectedPngBytes = Files.readAllBytes(goldenPngFile);
assertThat(actualPngBytes)
.as("Visual regression detected for %s. PNG output does not match golden reference.", scenario.name())
.containsExactly(expectedPngBytes);
}
}
}

View File

@@ -25,71 +25,80 @@ public class PlantUmlRenderTest {
private final EnrichmentService enrichmentService = new EnrichmentService(Collections.emptyList());
private final ExportService exportService = new ExportService(exporters, enrichmentService);
private static Path findProjectRoot() {
Path current = Path.of(".").toAbsolutePath();
while (current != null && !Files.exists(current.resolve("settings.gradle"))) {
current = current.getParent();
}
return current;
}
private static List<TestScenario> provideTestScenarios() {
Path root = findProjectRoot();
return List.of(
new TestScenario(
"Complex State Machine",
Path.of("../state_machines/complex_state_machine"),
root.resolve("state_machines/complex_state_machine"),
Path.of("src/test/resources/golden/ComplexStateMachineConfig"),
"ComplexStateMachineConfig"
),
new TestScenario(
"Fork Join State Machine",
Path.of("../state_machines/forkjoin_state_machine"),
root.resolve("state_machines/forkjoin_state_machine"),
Path.of("src/test/resources/golden/ForkJoinStateMachineConfig"),
"ForkJoinStateMachineConfig"
),
new TestScenario(
"Kamil Enum State Machine",
Path.of("../state_machines/enumstate_state_machine"),
root.resolve("state_machines/enumstate_state_machine"),
Path.of("src/test/resources/golden/KamilEnumStateMachineConfiguration"),
"KamilEnumStateMachineConfiguration"
),
new TestScenario(
"Simple Enum Join State Machine",
Path.of("../state_machines/simple_state_machine"),
root.resolve("state_machines/simple_state_machine"),
Path.of("src/test/resources/golden/SimpleEnumStateMachineConfiguration"),
"SimpleEnumStateMachineConfiguration"
),
new TestScenario(
"One State Machine (Inheritance)",
Path.of("../state_machines/inheritance_state_machine"),
root.resolve("state_machines/inheritance_state_machine"),
Path.of("src/test/resources/golden/OneStateMachineConfiguration"),
"OneStateMachineConfiguration"
),
new TestScenario(
"Two State Machine (Extra Functions)",
Path.of("../state_machines/inheritance_extra_functions_state_machine"),
root.resolve("state_machines/inheritance_extra_functions_state_machine"),
Path.of("src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration"),
"TwoStateMachineConfiguration"
),
new TestScenario(
"Three State Machine (Extra Functions 2)",
Path.of("../state_machines/inheritance_extra_functions2_state_machine"),
root.resolve("state_machines/inheritance_extra_functions2_state_machine"),
Path.of("src/test/resources/golden/ThreeStateMachineConfiguration"),
"ThreeStateMachineConfiguration"
),
new TestScenario(
"F1 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F1StateMachineConfiguration"),
"F1StateMachineConfiguration"
),
new TestScenario(
"F2 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F2StateMachineConfiguration"),
"F2StateMachineConfiguration"
),
new TestScenario(
"G1 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G1StateMachineConfiguration"),
"G1StateMachineConfiguration"
),
new TestScenario(
"G2 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G2StateMachineConfiguration"),
"G2StateMachineConfiguration"
)
@@ -101,7 +110,7 @@ public class PlantUmlRenderTest {
void testRenderMatchesGolden(TestScenario scenario, @TempDir Path tempDir) throws Exception {
exportService.runExporter(scenario.inputPath(), tempDir, List.of("puml"), true);
// Find the generated directory
// Find the generated directory (it might be named with FQN)
List<Path> generatedDirs;
try (var stream = Files.list(tempDir)) {
generatedDirs = stream.filter(Files::isDirectory).toList();
@@ -111,37 +120,26 @@ public class PlantUmlRenderTest {
Path actualDir = generatedDirs.stream()
.filter(d -> d.getFileName().toString().endsWith(targetBaseName))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("No output directory found for " + targetBaseName));
.orElseThrow(() -> new IllegalArgumentException("No output directory found for " + targetBaseName + " in " + generatedDirs));
String actualBaseName = actualDir.getFileName().toString();
Path actualPumlFile = actualDir.resolve(actualBaseName + ".puml");
String fileName = actualBaseName + ".puml";
String goldenFileName = targetBaseName + ".puml";
assertThat(actualPumlFile).exists();
Path actualFile = actualDir.resolve(fileName);
Path goldenFile = scenario.goldenPath().resolve(goldenFileName);
// Render to PNG
renderToPng(actualPumlFile);
if (Boolean.getBoolean("updateGolden")) {
Files.createDirectories(goldenFile.getParent());
Files.copy(actualFile, goldenFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
} else {
assertThat(actualFile)
.as("File %s should exist in output", fileName)
.exists();
Path actualPngFile = actualDir.resolve(actualBaseName + ".png");
assertThat(actualPngFile).exists();
// Compare with Golden PNG
String goldenPngFileName = targetBaseName + ".png";
Path goldenPngFile = scenario.goldenPath().resolve(goldenPngFileName);
assertThat(goldenPngFile).as("Golden PNG %s should exist", goldenPngFileName).exists();
assertThat(Files.readAllBytes(actualPngFile))
.as("Rendered PNG mismatch for %s", actualBaseName)
.isEqualTo(Files.readAllBytes(goldenPngFile));
}
private void renderToPng(Path pumlFile) throws IOException, InterruptedException {
ProcessBuilder pb = new ProcessBuilder("plantuml", "-nometadata", pumlFile.toAbsolutePath().toString());
pb.inheritIO();
Process process = pb.start();
int exitCode = process.waitFor();
if (exitCode != 0) {
throw new RuntimeException("PlantUML rendering failed with exit code " + exitCode);
assertThat(actualFile)
.as("Content mismatch for %s", fileName)
.content().isEqualTo(Files.readString(goldenFile));
}
}
}

View File

@@ -25,71 +25,80 @@ public class RegressionTest {
private final EnrichmentService enrichmentService = new EnrichmentService(Collections.emptyList());
private final ExportService exportService = new ExportService(exporters, enrichmentService);
private static Path findProjectRoot() {
Path current = Path.of(".").toAbsolutePath();
while (current != null && !Files.exists(current.resolve("settings.gradle"))) {
current = current.getParent();
}
return current;
}
private static List<TestScenario> provideTestScenarios() {
Path root = findProjectRoot();
return List.of(
new TestScenario(
"Complex State Machine",
Path.of("../state_machines/complex_state_machine"),
root.resolve("state_machines/complex_state_machine"),
Path.of("src/test/resources/golden/ComplexStateMachineConfig"),
"ComplexStateMachineConfig"
),
new TestScenario(
"Fork Join State Machine",
Path.of("../state_machines/forkjoin_state_machine"),
root.resolve("state_machines/forkjoin_state_machine"),
Path.of("src/test/resources/golden/ForkJoinStateMachineConfig"),
"ForkJoinStateMachineConfig"
),
new TestScenario(
"Kamil Enum State Machine",
Path.of("../state_machines/enumstate_state_machine"),
root.resolve("state_machines/enumstate_state_machine"),
Path.of("src/test/resources/golden/KamilEnumStateMachineConfiguration"),
"KamilEnumStateMachineConfiguration"
),
new TestScenario(
"Simple Enum Join State Machine",
Path.of("../state_machines/simple_state_machine"),
root.resolve("state_machines/simple_state_machine"),
Path.of("src/test/resources/golden/SimpleEnumStateMachineConfiguration"),
"SimpleEnumStateMachineConfiguration"
),
new TestScenario(
"One State Machine (Inheritance)",
Path.of("../state_machines/inheritance_state_machine"),
root.resolve("state_machines/inheritance_state_machine"),
Path.of("src/test/resources/golden/OneStateMachineConfiguration"),
"OneStateMachineConfiguration"
),
new TestScenario(
"Two State Machine (Extra Functions)",
Path.of("../state_machines/inheritance_extra_functions_state_machine"),
root.resolve("state_machines/inheritance_extra_functions_state_machine"),
Path.of("src/test/resources/golden/TwoStateMachineExtraFunctionsConfiguration"),
"TwoStateMachineConfiguration"
),
new TestScenario(
"Three State Machine (Extra Functions 2)",
Path.of("../state_machines/inheritance_extra_functions2_state_machine"),
root.resolve("state_machines/inheritance_extra_functions2_state_machine"),
Path.of("src/test/resources/golden/ThreeStateMachineConfiguration"),
"ThreeStateMachineConfiguration"
),
new TestScenario(
"F1 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F1StateMachineConfiguration"),
"F1StateMachineConfiguration"
),
new TestScenario(
"F2 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/F2StateMachineConfiguration"),
"F2StateMachineConfiguration"
),
new TestScenario(
"G1 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G1StateMachineConfiguration"),
"G1StateMachineConfiguration"
),
new TestScenario(
"G2 State Machine (Example 4)",
Path.of("../state_machines/inheritance_extra_functions3_state_machine"),
root.resolve("state_machines/inheritance_extra_functions3_state_machine"),
Path.of("src/test/resources/golden/G2StateMachineConfiguration"),
"G2StateMachineConfiguration"
)
@@ -122,13 +131,18 @@ public class RegressionTest {
Path actualFile = actualDir.resolve(fileName);
Path goldenFile = scenario.goldenPath().resolve(goldenFileName);
assertThat(actualFile)
.as("File %s should exist in output", fileName)
.exists();
if (Boolean.getBoolean("updateGolden")) {
Files.createDirectories(goldenFile.getParent());
Files.copy(actualFile, goldenFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
} else {
assertThat(actualFile)
.as("File %s should exist in output", fileName)
.exists();
assertThat(actualFile)
.as("Content mismatch for %s", fileName)
.content().isEqualTo(Files.readString(goldenFile));
assertThat(actualFile)
.as("Content mismatch for %s", fileName)
.content().isEqualTo(Files.readString(goldenFile));
}
}
}
}

View File

@@ -1,5 +1,6 @@
package click.kamil.springstatemachineexporter.exporter;
import click.kamil.springstatemachineexporter.analysis.model.AnalysisResult;
import click.kamil.springstatemachineexporter.model.State;
import click.kamil.springstatemachineexporter.model.Transition;
import click.kamil.springstatemachineexporter.model.TransitionType;
@@ -21,7 +22,14 @@ class JsonExporterTest {
transition.setTargetStates(List.of(State.of("S2")));
transition.setEvent("E1");
String json = exporter.export("TestSM", List.of(transition), Set.of("S1"), Set.of("S2"), ExportOptions.builder().build());
AnalysisResult result = AnalysisResult.builder()
.name("TestSM")
.transitions(List.of(transition))
.startStates(Set.of("S1"))
.endStates(Set.of("S2"))
.build();
String json = exporter.export(result, ExportOptions.builder().build());
assertThat(json)
.contains("\"name\" : \"TestSM\"")