From 84f0f216b4643601e4b8760d190b087bbce98bd4 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Sat, 6 Jun 2015 16:40:04 +1000 Subject: Lots of work on the stateful checking stuff: it's a fair bit nicer now --- .../java/au/id/zancanaro/javacheck/state/Command.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck/state/Command.java') diff --git a/src/main/java/au/id/zancanaro/javacheck/state/Command.java b/src/main/java/au/id/zancanaro/javacheck/state/Command.java index afa3957..78df8f1 100644 --- a/src/main/java/au/id/zancanaro/javacheck/state/Command.java +++ b/src/main/java/au/id/zancanaro/javacheck/state/Command.java @@ -2,22 +2,26 @@ package au.id.zancanaro.javacheck.state; import au.id.zancanaro.javacheck.Generator; -public abstract class Command { - public Generator argsGenerator(State state) { +public abstract class Command { + public Generator argsGenerator(S state) { return Generator.pure(null); } - public boolean preCondition(State state, Args args) { + public boolean preCondition(S state, A args) { return true; } - public abstract Result runCommand(Args args); + public abstract R runCommand(S state, A args) throws Throwable; - public State nextState(State state, Args args, CommandValue result) { + public S nextState(S state, A args, CommandValue result) { return state; } - public boolean postCondition(State oldState, State newState, Args args, Result result) { - return true; + public void postCondition(S oldState, S newState, A args, R result) throws Throwable { + } + + @Override + public String toString() { + return this.getClass().getSimpleName(); } } -- cgit v1.2.3