aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/common/test/Test.java
diff options
context:
space:
mode:
authorJ08nY2024-03-22 23:58:55 +0100
committerJ08nY2024-03-25 14:52:43 +0100
commit73af477a8774e1ede5dd8de6491eb353dc0b12bd (patch)
tree2d4e3b19bc5fb55308b886032312be76341736d4 /src/cz/crcs/ectester/common/test/Test.java
parent64b95fa059295e1dc23371c849f2302c1c18f5b4 (diff)
downloadECTester-73af477a8774e1ede5dd8de6491eb353dc0b12bd.tar.gz
ECTester-73af477a8774e1ede5dd8de6491eb353dc0b12bd.tar.zst
ECTester-73af477a8774e1ede5dd8de6491eb353dc0b12bd.zip
Basic Gradle setup.
Diffstat (limited to 'src/cz/crcs/ectester/common/test/Test.java')
-rw-r--r--src/cz/crcs/ectester/common/test/Test.java83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/cz/crcs/ectester/common/test/Test.java b/src/cz/crcs/ectester/common/test/Test.java
deleted file mode 100644
index 8bf9502..0000000
--- a/src/cz/crcs/ectester/common/test/Test.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package cz.crcs.ectester.common.test;
-
-import static cz.crcs.ectester.common.test.Result.Value;
-
-/**
- * An abstract test that can be run and has a Result.
- *
- * @author Jan Jancar johny@neuromancer.sk
- */
-public abstract class Test implements Testable, Cloneable {
- protected boolean hasRun;
- protected boolean hasStarted;
- protected Result result;
-
- public Result getResult() {
- return result;
- }
-
- public boolean ok() {
- if (result == null) {
- return true;
- }
- return result.ok();
- }
-
- @Override
- public boolean error() {
- if (result == null) {
- return false;
- }
- return result.compareTo(Value.ERROR);
- }
-
- @Override
- public Object errorCause() {
- if (result == null || !result.compareTo(Value.ERROR)) {
- return null;
- }
- return result.getCause();
- }
-
- @Override
- public boolean hasRun() {
- return hasRun;
- }
-
- public boolean hasStarted() {
- return hasStarted;
- }
-
- @Override
- public void reset() {
- hasRun = false;
- hasStarted = false;
- result = null;
- }
-
- public abstract String getDescription();
-
- @Override
- public Test clone() throws CloneNotSupportedException {
- return (Test) super.clone();
- }
-
- @Override
- public void run() {
- if (hasRun)
- return;
- try {
- hasStarted = true;
- runSelf();
- hasRun = true;
- } catch (TestException e) {
- result = new Result(Value.ERROR, e);
- throw e;
- } catch (Exception e) {
- result = new Result(Value.ERROR, e);
- throw new TestException(e);
- }
- }
-
- protected abstract void runSelf();
-}