summaryrefslogtreecommitdiff
path: root/src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2015-06-05 17:30:46 +1000
committerCarlo Zancanaro <carlo@zancanaro.id.au>2015-06-05 17:30:46 +1000
commit05ec409ce96da92d430c4a8e58b08d46f42d667a (patch)
tree2c3d8925fa9dd86cc265dcfbcb1fe5d8ee97cd0b /src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java
parent20b1226b4eb10e85497862bd73fe9e9a2f05191d (diff)
More work on the stateful checker; still not perfect, but it's getting better
Diffstat (limited to 'src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java')
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/state/CommandResult.java31
1 files changed, 31 insertions, 0 deletions
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<State> {
+ 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 <State> CommandResult<State> success(State state) {
+ return new CommandResult<>(state, null);
+ }
+
+ public static <State> CommandResult<State> fail(State state, Throwable ex) {
+ return new CommandResult<>(state, ex);
+ }
+}