diff --git a/common/src/main/java/cz/crcs/ectester/common/output/BaseTextTestWriter.java b/common/src/main/java/cz/crcs/ectester/common/output/BaseTextTestWriter.java index 177022be..f41d6468 100644 --- a/common/src/main/java/cz/crcs/ectester/common/output/BaseTextTestWriter.java +++ b/common/src/main/java/cz/crcs/ectester/common/output/BaseTextTestWriter.java @@ -6,9 +6,7 @@ import java.io.PrintStream; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.time.Duration; import java.util.Date; -import java.util.concurrent.TimeUnit; /** * An absctract basis of a TextTestWriter, which outputs in a human readable format, into console. @@ -89,7 +87,9 @@ private String testString(Test t, String prefix, int index) { out.append(String.format(widthSpec, desc)); out.append(" ┃ "); Colors.Foreground valueColor; - if (result.getValue().ok()) { + if (result.getValue().equals(Result.Value.OKSUCCESS) || result.getValue().equals(Result.Value.OKFAILURE)) { + valueColor = Colors.Foreground.WHITE; + } else if (result.getValue().ok()) { valueColor = Colors.Foreground.GREEN; } else if (result.getValue().equals(Result.Value.ERROR)) { valueColor = Colors.Foreground.RED; diff --git a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java index e5d68dc6..0e972551 100644 --- a/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java +++ b/common/src/main/java/cz/crcs/ectester/common/test/CompoundTest.java @@ -38,7 +38,7 @@ public class CompoundTest extends Test implements Cloneable { public final static Consumer RUN_ALL_IF_FIRST = tests -> { tests[0].run(); - if (tests[0].getResult().getValue().equals(Result.Value.SUCCESS) || tests[0].getResult().getValue().equals(Result.Value.UXSUCCESS)) { + if (tests[0].getResult().getValue().successful()) { for (int i = 1; i < tests.length; i++) { tests[i].run(); } diff --git a/common/src/main/java/cz/crcs/ectester/common/test/Result.java b/common/src/main/java/cz/crcs/ectester/common/test/Result.java index f065f9c7..71ab6311 100644 --- a/common/src/main/java/cz/crcs/ectester/common/test/Result.java +++ b/common/src/main/java/cz/crcs/ectester/common/test/Result.java @@ -49,21 +49,25 @@ public boolean compareTo(Value other) { * A result value of a Test. */ public enum Value { - SUCCESS(true, "Expected success."), - FAILURE(false, "Unexpected failure."), - UXSUCCESS(false, "Unexpected success."), - XFAILURE(true, "Expected failure."), - ERROR(false, "Error."); + SUCCESS(true, true, "Expected success."), + FAILURE(false, false, "Unexpected failure."), + UXSUCCESS(false, true, "Unexpected success."), + XFAILURE(true, false, "Expected failure."), + OKSUCCESS(true, true, "Any result is OK."), + OKFAILURE(true, false, "Any result is OK."), + ERROR(false, false, "Error."); private boolean ok; + private boolean successful; private String desc; - Value(boolean ok) { + Value(boolean ok, boolean successful) { this.ok = ok; + this.successful = successful; } - Value(boolean ok, String desc) { - this(ok); + Value(boolean ok, boolean successful, String desc) { + this(ok, successful); this.desc = desc; } @@ -74,7 +78,7 @@ public static Value fromExpected(ExpectedValue expected, boolean successful) { case FAILURE: return successful ? UXSUCCESS : XFAILURE; case ANY: - return successful ? SUCCESS : XFAILURE; + return successful ? OKSUCCESS : OKFAILURE; } return SUCCESS; } @@ -90,6 +94,10 @@ public boolean ok() { return ok; } + public boolean successful() { + return successful; + } + public String description() { return desc; }