From 05ec409ce96da92d430c4a8e58b08d46f42d667a Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Fri, 5 Jun 2015 17:30:46 +1000 Subject: More work on the stateful checker; still not perfect, but it's getting better --- .../zancanaro/javacheck/state/CommandResult.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java (limited to 'src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java') diff --git a/src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java b/src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java new file mode 100644 index 0000000..12f650d --- /dev/null +++ b/src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java @@ -0,0 +1,31 @@ +package au.id.zancanaro.javacheck.state; + +public class CommandResult { + private final State state; + private final Throwable thrown; + + private CommandResult(State state, Throwable thrown) { + this.state = state; + this.thrown = thrown; + } + + public State getState() { + return state; + } + + public boolean isFailed() { + return thrown != null; + } + + public Throwable getThrown() { + return thrown; + } + + public static CommandResult success(State state) { + return new CommandResult<>(state, null); + } + + public static CommandResult fail(State state, Throwable ex) { + return new CommandResult<>(state, ex); + } +} -- cgit v1.2.3