-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc7da62
commit c5d3d4b
Showing
35 changed files
with
807 additions
and
818 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
pebl/src/main/java/pebl/test/steps/GatherAndAssertTracesTestStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package pebl.test.steps; | ||
|
||
import pebl.test.assertions.Trace; | ||
import pebl.test.assertions.TraceTestAssertion; | ||
|
||
public class GatherAndAssertTracesTestStep extends AssertableTestStep { | ||
|
||
public GatherAndAssertTracesTestStep addTrace(Trace trace) { | ||
getAssertions().add(new TraceTestAssertion(trace)); | ||
|
||
return this; | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
pebl/src/main/java/pebl/test/steps/ProcessStartWithVariablesTestStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package pebl.test.steps; | ||
|
||
import java.util.Collections; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import pebl.test.TestStep; | ||
|
||
public class ProcessStartWithVariablesTestStep extends TestStep { | ||
|
||
private List<Variable> variables = new LinkedList<>(); | ||
private String process; | ||
|
||
public ProcessStartWithVariablesTestStep addVariable(Variable variable) { | ||
this.variables.add(variable); | ||
|
||
return this; | ||
} | ||
|
||
public List<Variable> getVariables() { | ||
return Collections.unmodifiableList(variables); | ||
} | ||
|
||
public String getProcess() { | ||
return process; | ||
} | ||
|
||
public void setProcess(String process) { | ||
this.process = process; | ||
} | ||
} |
39 changes: 0 additions & 39 deletions
39
pebl/src/main/java/pebl/test/steps/VariableBasedTestStep.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package betsy.bpmn.engines; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
import pebl.test.TestCase; | ||
import pebl.test.assertions.Trace; | ||
import pebl.test.assertions.TraceTestAssertion; | ||
import pebl.test.steps.AssertableTestStep; | ||
import pebl.test.steps.GatherAndAssertTracesTestStep; | ||
import pebl.test.steps.ProcessStartWithVariablesTestStep; | ||
|
||
public class TestCaseUtil { | ||
public static String getKey(TestCase testCase) { | ||
return testCase.getTestSteps().stream() | ||
.filter(ts -> ts instanceof ProcessStartWithVariablesTestStep) | ||
.map(ts -> (ProcessStartWithVariablesTestStep)ts) | ||
.filter(ts -> !ts.getVariables().isEmpty()) | ||
.map(ProcessStartWithVariablesTestStep::getProcess) | ||
.findFirst().orElseThrow(() -> new IllegalStateException("test case should a key somewhere: " + testCase)); | ||
} | ||
|
||
public static List<String> getTraceAssertions(TestCase testCase) { | ||
return Optional.of(testCase) | ||
.map(tc -> tc.getTestSteps() | ||
.stream() | ||
.filter(ts -> ts instanceof GatherAndAssertTracesTestStep) | ||
.map(ts -> (GatherAndAssertTracesTestStep) ts) | ||
.map(AssertableTestStep::getAssertions) | ||
.flatMap(ta -> ta.stream() | ||
.filter(ts -> ts instanceof TraceTestAssertion) | ||
.map(ts -> (TraceTestAssertion) ts) | ||
.map(TraceTestAssertion::getTrace) | ||
.map(Trace::getValue)) | ||
.collect(Collectors.toList())).orElse(Collections.emptyList()); | ||
} | ||
|
||
public static String getNormalizedTestCaseName(TestCase testCase) { | ||
StringBuilder sb = new StringBuilder(); | ||
sb.append("test").append(testCase.getNumber()).append("Assert"); | ||
for (String assertion : getTraceAssertions(testCase)) { | ||
sb.append(capitalize(assertion)); | ||
} | ||
return sb.toString(); | ||
} | ||
|
||
private static String capitalize(String self) { | ||
if (self == null || self.length() == 0) { | ||
return self; | ||
} | ||
return Character.toUpperCase(self.charAt(0)) + self.substring(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.