summaryrefslogtreecommitdiff
path: root/src/main/java/au/id
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/au/id')
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/state/CommandList.java6
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/state/CommandListGenerator.java2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/au/id/zancanaro/javacheck/state/CommandList.java b/src/main/java/au/id/zancanaro/javacheck/state/CommandList.java
index 05000f2..31fbc12 100644
--- a/src/main/java/au/id/zancanaro/javacheck/state/CommandList.java
+++ b/src/main/java/au/id/zancanaro/javacheck/state/CommandList.java
@@ -4,8 +4,10 @@ import java.util.*;
public class CommandList<S> {
private final List<GeneratedCommand<S, ?, ?>> commands;
+ private final S initialState;
- public CommandList(List<GeneratedCommand<S, ?, ?>> commands) {
+ public CommandList(S initialState, List<GeneratedCommand<S, ?, ?>> commands) {
+ this.initialState = initialState;
this.commands = new ArrayList<>(commands);
}
@@ -67,7 +69,7 @@ public class CommandList<S> {
}
public boolean isValid() {
- CommandResult<S> result = CommandResult.success(null);
+ CommandResult<S> result = CommandResult.success(initialState);
for (GeneratedCommand<S, ?, ?> generated : commands) {
result = runAbstractCommand(generated, result.getState());
if (result.isFailed()) {
diff --git a/src/main/java/au/id/zancanaro/javacheck/state/CommandListGenerator.java b/src/main/java/au/id/zancanaro/javacheck/state/CommandListGenerator.java
index 1600f07..c5cda59 100644
--- a/src/main/java/au/id/zancanaro/javacheck/state/CommandListGenerator.java
+++ b/src/main/java/au/id/zancanaro/javacheck/state/CommandListGenerator.java
@@ -46,7 +46,7 @@ public class CommandListGenerator<S> implements Generator<CommandList<S>> {
state = nextState(i, generatedCommand, state);
}
return ShrinkTree.combine(commandTrees, ShrinkTree::removeAndPromoteChildren)
- .map(list -> new CommandList<>(list))
+ .map(list -> new CommandList<>(initialState, list))
.filter(CommandList::isValid);
}
}