Update of /var/cvs/tests/bridge/org/mmbase/bridge
In directory james.mmbase.org:/tmp/cvs-serv28654
Modified Files:
NodeTest.java
Log Message:
check for type of exception too
See also: http://cvs.mmbase.org/viewcvs/tests/bridge/org/mmbase/bridge
Index: NodeTest.java
===================================================================
RCS file: /var/cvs/tests/bridge/org/mmbase/bridge/NodeTest.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- NodeTest.java 22 Sep 2008 16:40:49 -0000 1.23
+++ NodeTest.java 22 Sep 2008 17:12:39 -0000 1.24
@@ -11,6 +11,7 @@
package org.mmbase.bridge;
import java.util.Iterator;
+import java.util.regex.Pattern;
import org.mmbase.tests.*;
import org.mmbase.security.AuthenticationData;
@@ -363,12 +364,20 @@
}
}
+ private static final Pattern NO_FIELD =
Pattern.compile("(?i).*field.*nonexistingfield.*");
public void testNonExistingField() {
try {
node.getStringValue("nonexistingfield");
fail("Getting non existing field should throw a (clear)
exception");
- } catch (RuntimeException e) {
-
assertTrue(java.util.regex.Pattern.compile(".*field.*nonexistingfield.*").matcher(e.getMessage()).matches());
+ } catch (IllegalArgumentException e) {
+ assertTrue(e.getMessage() + " does not match " + NO_FIELD,
NO_FIELD.matcher(e.getMessage()).matches());
+ }
+
+ try {
+ node.getFieldValue("nonexistingfield");
+ fail("Getting non existing field should throw a (clear)
exception");
+ } catch (NotFoundException e) {
+ assertTrue(e.getMessage() + " does not match " + NO_FIELD,
NO_FIELD.matcher(e.getMessage()).matches());
}
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs