You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/07/26 09:37:44 UTC
svn commit: r225248 -
/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java
Author: jeremias
Date: Tue Jul 26 00:37:41 2005
New Revision: 225248
URL: http://svn.apache.org/viewcvs?rev=225248&view=rev
Log:
Optional attribute "fail-msg" for the "true" check so a custom error message can be supplied.
Modified:
xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java?rev=225248&r1=225247&r2=225248&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/layoutengine/TrueCheck.java Tue Jul 26 00:37:41 2005
@@ -31,6 +31,7 @@
public class TrueCheck implements LayoutEngineCheck {
private String xpath;
+ private String failureMessage;
/**
* Creates a new instance
@@ -46,6 +47,10 @@
*/
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 @@
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 + ")");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org