aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cz/crcs/ectester/reader/test/Result.java44
-rw-r--r--src/cz/crcs/ectester/reader/test/Test.java2
2 files changed, 30 insertions, 16 deletions
diff --git a/src/cz/crcs/ectester/reader/test/Result.java b/src/cz/crcs/ectester/reader/test/Result.java
index 9110929..82f0f32 100644
--- a/src/cz/crcs/ectester/reader/test/Result.java
+++ b/src/cz/crcs/ectester/reader/test/Result.java
@@ -29,11 +29,29 @@ public class Result {
return value.ok();
}
+ public boolean compareTo(Result other) {
+ if (other == null) {
+ return false;
+ }
+ return value == other.value;
+ }
+
+ public boolean compareTo(Value other) {
+ if (other == null) {
+ return false;
+ }
+ return value == other;
+ }
+
+ /**
+ *
+ */
public enum Value {
SUCCESS(true),
FAILURE(false),
UXSUCCESS(false),
- XFAILURE(true);
+ XFAILURE(true),
+ ERROR(false);
private boolean ok;
@@ -53,28 +71,24 @@ public class Result {
return SUCCESS;
}
+ public static Value fromExpected(ExpectedValue expected, boolean successful, boolean error) {
+ if (error) {
+ return ERROR;
+ }
+ return fromExpected(expected, successful);
+ }
+
public boolean ok() {
return ok;
}
}
+ /**
+ *
+ */
public enum ExpectedValue {
SUCCESS,
FAILURE,
ANY
}
-
- public boolean compareTo(Result other) {
- if (other == null) {
- return false;
- }
- return value == other.value;
- }
-
- public boolean compareTo(Value other) {
- if (other == null) {
- return false;
- }
- return value == other;
- }
}
diff --git a/src/cz/crcs/ectester/reader/test/Test.java b/src/cz/crcs/ectester/reader/test/Test.java
index 48280ed..022ad56 100644
--- a/src/cz/crcs/ectester/reader/test/Test.java
+++ b/src/cz/crcs/ectester/reader/test/Test.java
@@ -71,7 +71,7 @@ public abstract class Test {
public Simple(Command command, ExpectedValue expected, String ok, String nok) {
this(command, (cmd, resp) -> {
- Value resultValue = Value.fromExpected(expected, resp.successful());
+ Value resultValue = Value.fromExpected(expected, resp.successful(), resp.error());
return new Result(resultValue, resultValue.ok() ? ok : nok);
});
}