diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-07-26 07:37:41 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-07-26 07:37:41 +0000 |
commit | 89060b99d9e8f32d165a34c05f6cd8ca840b97b2 (patch) | |
tree | 40d62c4a5dd86d2744f4402a8da7ad38cb9ccd5c /test/java/org/apache/fop/layoutengine | |
parent | 59f30b83ae084e0892e728eac678a910e6fc796c (diff) | |
download | xmlgraphics-fop-89060b99d9e8f32d165a34c05f6cd8ca840b97b2.tar.gz xmlgraphics-fop-89060b99d9e8f32d165a34c05f6cd8ca840b97b2.zip |
Optional attribute "fail-msg" for the "true" check so a custom error message can be supplied.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225248 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/layoutengine')
-rw-r--r-- | test/java/org/apache/fop/layoutengine/TrueCheck.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/java/org/apache/fop/layoutengine/TrueCheck.java b/test/java/org/apache/fop/layoutengine/TrueCheck.java index 8ecaf9b0b..eb2c3a40b 100644 --- a/test/java/org/apache/fop/layoutengine/TrueCheck.java +++ b/test/java/org/apache/fop/layoutengine/TrueCheck.java @@ -31,6 +31,7 @@ import org.w3c.dom.Node; public class TrueCheck implements LayoutEngineCheck { private String xpath; + private String failureMessage; /** * Creates a new instance @@ -46,6 +47,10 @@ public class TrueCheck implements LayoutEngineCheck { */ public TrueCheck(Node node) { this.xpath = node.getAttributes().getNamedItem("xpath").getNodeValue(); + Node nd = node.getAttributes().getNamedItem("fail-msg"); + if (nd != null) { + this.failureMessage = nd.getNodeValue(); + } } /** @see org.apache.fop.layoutengine.LayoutEngineCheck */ @@ -57,9 +62,13 @@ public class TrueCheck implements LayoutEngineCheck { throw new RuntimeException("XPath evaluation failed: " + e.getMessage()); } if (!XBoolean.S_TRUE.equals(res)) { - throw new RuntimeException( - "Expected XPath expression to evaluate to 'true', but got '" - + res + "' (" + this + ")"); + if (failureMessage != null) { + throw new RuntimeException(failureMessage); + } else { + throw new RuntimeException( + "Expected XPath expression to evaluate to 'true', but got '" + + res + "' (" + this + ")"); + } } } |