From: wisberg Date: Sat, 31 May 2003 22:20:51 +0000 (+0000) Subject: normal validation now fail if an Integer result not of value 0 X-Git-Tag: V1_1_0~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dd76d2fc194461656360c5cdd6ad0769ace0184a;p=aspectj.git normal validation now fail if an Integer result not of value 0 --- diff --git a/testing/src/org/aspectj/testing/run/RunValidator.java b/testing/src/org/aspectj/testing/run/RunValidator.java index 9cf91e37a..70b5e0018 100644 --- a/testing/src/org/aspectj/testing/run/RunValidator.java +++ b/testing/src/org/aspectj/testing/run/RunValidator.java @@ -37,8 +37,12 @@ import org.aspectj.testing.util.ObjectChecker; * e.g., as underlying components signal ABORT without using abort(...). */ public class RunValidator implements IRunValidator { - /** expect normal completion with any non-null result object */ + /** expect normal completion with any non-null result object, + * except that Integer Objects must have value 0 */ public static final IRunValidator NORMAL + = new RunValidator(ObjectChecker.ANY_ZERO); + /** expect normal completion with any non-null result object */ + public static final IRunValidator ORIGINAL_NORMAL = new RunValidator(ObjectChecker.ANY); /** expect normal completion and Integer result object with value 0 */ diff --git a/testing/src/org/aspectj/testing/util/ObjectChecker.java b/testing/src/org/aspectj/testing/util/ObjectChecker.java index e7d42755a..7d1927404 100644 --- a/testing/src/org/aspectj/testing/util/ObjectChecker.java +++ b/testing/src/org/aspectj/testing/util/ObjectChecker.java @@ -23,10 +23,23 @@ public interface ObjectChecker { public final boolean isValid(Object input) { return true; } public final String toString() { return "ObjectChecker.ANY"; } }; + /** this returns true for any non-null object */ public static final ObjectChecker NOT_NULL = new ObjectChecker() { public boolean isValid(Object input) { return (null != input); } - public String toString() { return "ObjectChecker.MOT_NULL"; } + public String toString() { return "ObjectChecker.NOT_NULL"; } + }; + + /** @return true if input is 0 Integer or any other non-Integer reference. */ + public static final ObjectChecker ANY_ZERO = new ObjectChecker() { + public boolean isValid(Object input) { + if (input instanceof Integer) { + return (0 == ((Integer) input).intValue()); + } else { + return true; + } + } + public String toString() { return "ObjectChecker.ANY_ZERO"; } }; /**