one more example
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package click.kamil.springstatemachineexporter;
|
||||
|
||||
import click.kamil.springstatemachineexporter.ast.common.CodebaseContext;
|
||||
import click.kamil.springstatemachineexporter.ast.out.Dot;
|
||||
import click.kamil.springstatemachineexporter.ast.out.PlantUml;
|
||||
import click.kamil.springstatemachineexporter.ast.out.Scxml;
|
||||
@@ -15,9 +16,9 @@ import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class RegressionTest {
|
||||
public class RegressionTest {
|
||||
|
||||
static List<TestScenario> provideTestScenarios() {
|
||||
private static List<TestScenario> provideTestScenarios() {
|
||||
return List.of(
|
||||
new TestScenario(
|
||||
"Complex State Machine",
|
||||
@@ -54,23 +55,28 @@ class RegressionTest {
|
||||
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"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@MethodSource("provideTestScenarios")
|
||||
void testOutputMatchesGolden(TestScenario scenario, @TempDir Path tempDir) throws Exception {
|
||||
Main.runExporter(scenario.inputPath(), tempDir);
|
||||
CodebaseContext context = new CodebaseContext();
|
||||
context.scan(scenario.inputPath());
|
||||
|
||||
List<StateMachineExporter> exporters = List.of(
|
||||
new PlantUml(),
|
||||
new Dot(),
|
||||
new Scxml()
|
||||
);
|
||||
List<StateMachineExporter> outputs = List.of(new PlantUml(), new Dot(), new Scxml());
|
||||
|
||||
Main.exportAll(context, outputs, tempDir);
|
||||
|
||||
String baseName = scenario.baseName();
|
||||
|
||||
for (StateMachineExporter exporter : exporters) {
|
||||
for (StateMachineExporter exporter : outputs) {
|
||||
String fileName = baseName + exporter.getFileExtension();
|
||||
|
||||
Path actualFile = tempDir.resolve(baseName).resolve(fileName);
|
||||
|
||||
Reference in New Issue
Block a user