Skip to content

Commit

Permalink
refactor: simplify tests that always generate both svg and bpmn
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard committed Jun 3, 2021
1 parent 382cd9a commit 7f20a63
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ public class AppFromBpmnTest {

@Test
public void main_generates_output_files_for_A_2_0() throws Exception {
runAndCheckBPMNGeneration("bpmn/A.2.0.bpmn.xml", "A.2.0_with_diagram.bpmn.xml");
runAndCheckSvgGeneration("bpmn/A.2.0.bpmn.xml", "A.2.0_with_diagram.bpmn.svg");
runAndCheckBpmnAndSvgGeneration("bpmn/A.2.0.bpmn.xml", "A.2.0_with_diagram.bpmn");
}

@Test
public void main_generates_output_files_for_A_2_1() throws Exception {
runAndCheckBPMNGeneration("bpmn/A.2.1.bpmn.xml", "A.2.1_with_diagram.bpmn.xml");
runAndCheckSvgGeneration("bpmn/A.2.1.bpmn.xml", "A.2.1_with_diagram.bpmn.svg");
runAndCheckBpmnAndSvgGeneration("bpmn/A.2.1.bpmn.xml", "A.2.1_with_diagram.bpmn");
}

@Test
Expand All @@ -51,21 +49,26 @@ public void main_generates_ascii_output_file() throws Exception {

@Test
public void main_generates_output_files_for_waypoints_positions_for_gateways() throws Exception {
runAndCheckBPMNGeneration("bpmn/waypoints-positions-gateways.bpmn.xml", "waypoints-positions_with_diagram.bpmn.xml");
runAndCheckSvgGeneration("bpmn/waypoints-positions-gateways.bpmn.xml", "waypoints-positions_with_diagram.bpmn.svg");
runAndCheckBpmnAndSvgGeneration("bpmn/waypoints-positions-gateways.bpmn.xml",
"waypoints-positions_with_diagram.bpmn");
}

@Test
public void main_generates_output_files_for_waypoints_positions_for_gateways_split_merge() throws Exception {
runAndCheckBPMNGeneration("bpmn/waypoints-positions-gateways_split_merge.bpmn.xml", "waypoints-positions-gateways_split_merge.bpmn.xml");
runAndCheckSvgGeneration("bpmn/waypoints-positions-gateways_split_merge.bpmn.xml", "waypoints-positions-gateways_split_merge.bpmn.svg");
runAndCheckBpmnAndSvgGeneration("bpmn/waypoints-positions-gateways_split_merge.bpmn.xml",
"waypoints-positions-gateways_split_merge.bpmn");
}

// =================================================================================================================
// UTILS
// =================================================================================================================

private static void runAndCheckBPMNGeneration(String inputFileName, String outputFileName) throws IOException {
private static void runAndCheckBpmnAndSvgGeneration(String inputFileName, String outputFileBaseName) throws IOException {
runAndCheckBpmnGeneration(inputFileName, outputFileBaseName + ".xml");
runAndCheckSvgGeneration(inputFileName, outputFileBaseName + ".svg");
}

private static void runAndCheckBpmnGeneration(String inputFileName, String outputFileName) throws IOException {
String outputPath = outputPath(outputFileName);
runApp(input(inputFileName), "-o", outputPath);
assertBpmnOutFile(outputPath);
Expand Down

0 comments on commit 7f20a63

Please sign in to comment.