cli
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
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;
|
||||
import click.kamil.springstatemachineexporter.ast.out.StateMachineExporter;
|
||||
import click.kamil.springstatemachineexporter.service.ExportService;
|
||||
import click.kamil.springstatemachineexporter.utils.TestScenario;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -18,6 +18,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class RegressionTest {
|
||||
|
||||
private final List<StateMachineExporter> exporters = List.of(new PlantUml(), new Dot(), new Scxml());
|
||||
private final ExportService exportService = new ExportService(exporters);
|
||||
|
||||
private static List<TestScenario> provideTestScenarios() {
|
||||
return List.of(
|
||||
new TestScenario(
|
||||
@@ -92,12 +95,7 @@ public class RegressionTest {
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@MethodSource("provideTestScenarios")
|
||||
void testOutputMatchesGolden(TestScenario scenario, @TempDir Path tempDir) throws Exception {
|
||||
CodebaseContext context = new CodebaseContext();
|
||||
context.scan(scenario.inputPath());
|
||||
|
||||
List<StateMachineExporter> outputs = List.of(new PlantUml(), new Dot(), new Scxml());
|
||||
|
||||
Main.exportAll(context, outputs, tempDir);
|
||||
exportService.runExporter(scenario.inputPath(), tempDir);
|
||||
|
||||
// Find the generated directory (it might be named with FQN)
|
||||
List<Path> generatedDirs;
|
||||
@@ -113,7 +111,7 @@ public class RegressionTest {
|
||||
|
||||
String actualBaseName = actualDir.getFileName().toString();
|
||||
|
||||
for (StateMachineExporter exporter : outputs) {
|
||||
for (StateMachineExporter exporter : exporters) {
|
||||
String fileName = actualBaseName + exporter.getFileExtension();
|
||||
String goldenFileName = targetBaseName + exporter.getFileExtension();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user