summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-05-31 22:20:51 +0000
committerwisberg <wisberg>2003-05-31 22:20:51 +0000
commitdd76d2fc194461656360c5cdd6ad0769ace0184a (patch)
tree689d3f87e4be46506daa2e13343229c7b2d5493b
parent02a2fdd335bd206c30a11e1653795a704718486c (diff)
downloadaspectj-dd76d2fc194461656360c5cdd6ad0769ace0184a.tar.gz
aspectj-dd76d2fc194461656360c5cdd6ad0769ace0184a.zip
normal validation now fail if an Integer result not of value 0
-rw-r--r--testing/src/org/aspectj/testing/run/RunValidator.java6
-rw-r--r--testing/src/org/aspectj/testing/util/ObjectChecker.java15
2 files changed, 19 insertions, 2 deletions
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"; }
};
/**