aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test
diff options
context:
space:
mode:
authorJ08nY2017-11-05 18:52:56 +0100
committerJ08nY2017-11-05 18:58:11 +0100
commitaa13c1ba0082d975cb9d1f1e0f0ab1f151438b02 (patch)
treed97a0392d37908ab3c7f93bf92d35f06e38e326e /src/cz/crcs/ectester/reader/test
parent45c555818a7bf2765434f2494d56a31af7dc6cfa (diff)
downloadECTester-aa13c1ba0082d975cb9d1f1e0f0ab1f151438b02.tar.gz
ECTester-aa13c1ba0082d975cb9d1f1e0f0ab1f151438b02.tar.zst
ECTester-aa13c1ba0082d975cb9d1f1e0f0ab1f151438b02.zip
Introduce Result.Value.ERROR.
- Value.ERROR is used when response.error() is true. - Value.ERROR is NOK.
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);
});
}