[Practicalxml-commits] SF.net SVN: practicalxml:[128] trunk
Brought to you by:
kdgregory
|
From: Auto-Generated S. C. M. <pra...@li...> - 2009-09-14 23:30:53
|
Revision: 128
http://practicalxml.svn.sourceforge.net/practicalxml/?rev=128&view=rev
Author: kdgregory
Date: 2009-09-14 23:30:45 +0000 (Mon, 14 Sep 2009)
Log Message:
-----------
DomAsserts: XPath assertions now take any node as initial context
Modified Paths:
--------------
trunk/pom.xml
trunk/src/main/java/net/sf/practicalxml/junit/DomAsserts.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-09-11 18:30:39 UTC (rev 127)
+++ trunk/pom.xml 2009-09-14 23:30:45 UTC (rev 128)
@@ -5,7 +5,7 @@
<groupId>net.sf.practicalxml</groupId>
<artifactId>practicalxml</artifactId>
<packaging>jar</packaging>
- <version>1.0.4</version>
+ <version>1.0.5-SNAPSHOT</version>
<name>practicalxml</name>
<url>http://sourceforge.net/projects/practicalxml/</url>
Modified: trunk/src/main/java/net/sf/practicalxml/junit/DomAsserts.java
===================================================================
--- trunk/src/main/java/net/sf/practicalxml/junit/DomAsserts.java 2009-09-11 18:30:39 UTC (rev 127)
+++ trunk/src/main/java/net/sf/practicalxml/junit/DomAsserts.java 2009-09-14 23:30:45 UTC (rev 128)
@@ -38,10 +38,10 @@
public class DomAsserts
{
/**
- * Asserts that an element has the given name, ignoring namespace.
+ * Asserts that an element has the given localname.
*
- * @param expected The expected name.
- * @param elem The element to assert.
+ * @param expected The expected name, sans prefix.
+ * @param elem The element on which to assert this name.
*/
public static void assertName(String expected, Element elem)
{
@@ -49,11 +49,11 @@
}
/**
- * Asserts that an element has the given name, ignoring namespace.
+ * Asserts that an element has the given localname.
*
* @param message Message to display if assertion fails.
- * @param expected The expected name.
- * @param elem The element to assert.
+ * @param expected The expected name, sans prefix.
+ * @param elem The element on which to assert this name.
*/
public static void assertName(String message, String expected, Element elem)
{
@@ -71,7 +71,7 @@
* </code> to assert that the element does not
* have a namespace.
* @param localName The expected name, sans prefix
- * @param elem The element to assert.
+ * @param elem The element on which to assert this name.
*/
public static void assertNamespaceAndName(
String expectedNSUri, String localName, Element elem)
@@ -89,7 +89,7 @@
* </code> to assert that the element does not
* have a namespace.
* @param localName The expected name, sans prefix
- * @param elem The element to assert.
+ * @param elem The element on which to assert this name.
*/
public static void assertNamespaceAndName(
String message, String expectedNSUri, String localName, Element elem)
@@ -100,189 +100,184 @@
/**
- * Asserts that the specified XPath selects at least one node.
- * <p>
- * Will display the XPath if assertion fails.
+ * Asserts that the specified XPath selects at least one node. Uses the
+ * path as a failed-assertion message.
*
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertExists(Element elem, String xpath)
+ public static void assertExists(Node node, String xpath)
{
- assertExists(xpath, elem, xpath);
+ assertExists(xpath, node, xpath);
}
/**
- * Asserts that the specified XPath selects at least one node.
+ * Asserts that the specified XPath selects at least one node, using
+ * the specified message if the assertion fails.
*
- * @param message Message to display if assertion fails.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertExists(String message, Element elem, String xpath)
+ public static void assertExists(String message, Node node, String xpath)
{
- assertExists(message, elem, new XPathWrapper(xpath));
+ assertExists(message, node, new XPathWrapper(xpath));
}
/**
- * Asserts that the specified XPath selects at least one node. Uses the
- * <code>XPathWrapper</code> class to allow more complex paths, including
- * namespace bindings.
- * <p>
- * Will display the XPath if assertion fails.
+ * Asserts that the specified XPath selects at least one node. Uses
+ * {@link net.sf.practicalxml.xpath.XPathWrapper} to allow complex
+ * paths, including namespace bindings. Uses the path as a failed-
+ * assertion message.
*
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertExists(Element elem, XPathWrapper xpath)
+ public static void assertExists(Node node, XPathWrapper xpath)
{
- assertExists(xpath.toString(), elem, xpath);
+ assertExists(xpath.toString(), node, xpath);
}
/**
- * Asserts that the specified XPath selects at least one node. Uses the
- * <code>XPathWrapper</code> class to allow more complex paths, including
- * namespace bindings.
+ * Asserts that the specified XPath selects at least one node. Uses
+ * {@link net.sf.practicalxml.xpath.XPathWrapper} to allow complex
+ * paths, including namespace bindings.
*
- * @param message Message to display if assertion fails.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertExists(String message, Element elem, XPathWrapper xpath)
+ public static void assertExists(String message, Node node, XPathWrapper xpath)
{
- List<Node> result = xpath.evaluate(elem);
+ List<Node> result = xpath.evaluate(node);
assertTrue(message, result.size() > 0);
}
/**
* Asserts that the specified XPath selects a specified number of nodes.
- * <p>
- * Will display the XPath if assertion fails.
+ * Uses the path as a failed-assertion message.
*
- * @param expected The expected number of nodes selected.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param expected The expected number of nodes selected.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertCount(int expected, Element elem, String xpath)
+ public static void assertCount(int expected, Node node, String xpath)
{
- assertCount(xpath, expected, elem, xpath);
+ assertCount(xpath, expected, node, xpath);
}
/**
* Asserts that the specified XPath selects a specified number of nodes.
*
- * @param message Message to display if assertion fails.
- * @param expected The expected number of nodes selected.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param expected The expected number of nodes selected.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
public static void assertCount(
- String message, int expected, Element elem, String xpath)
+ String message, int expected, Node node, String xpath)
{
- assertCount(message, expected, elem, new XPathWrapper(xpath));
+ assertCount(message, expected, node, new XPathWrapper(xpath));
}
/**
* Asserts that the specified XPath selects a specified number of nodes.
- * Uses the <code>XPathWrapper</code> class to allow more complex paths,
- * including namespace bindings.
- * <p>
- * Will display the XPath if assertion fails.
+ * Uses {@link net.sf.practicalxml.xpath.XPathWrapper} to allow complex
+ * paths, including namespace bindings. Uses the path as a failed-assertion
+ * message.
*
- * @param expected The expected number of nodes selected.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param expected The expected number of nodes selected.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertCount(int expected, Element elem, XPathWrapper xpath)
+ public static void assertCount(int expected, Node node, XPathWrapper xpath)
{
- assertCount(xpath.toString(), expected, elem, xpath);
+ assertCount(xpath.toString(), expected, node, xpath);
}
/**
* Asserts that the specified XPath selects a specified number of nodes.
- * Uses the <code>XPathWrapper</code> class to allow more complex paths,
- * including namespace bindings.
+ * Uses {@link net.sf.practicalxml.xpath.XPathWrapper} to allow complex
+ * paths, including namespace bindings.
*
- * @param message Message to display if assertion fails.
- * @param expected The expected number of nodes selected.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param expected The expected number of nodes selected.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
public static void assertCount(
- String message, int expected, Element elem, XPathWrapper xpath)
+ String message, int expected, Node node, XPathWrapper xpath)
{
- List<Node> result = xpath.evaluate(elem);
+ List<Node> result = xpath.evaluate(node);
Assert.assertEquals(message, expected, result.size());
}
/**
* Asserts that the specified XPath selects a particular String value.
- * <p>
- * Will display the XPath if assertion fails.
+ * Uses the path as a failed-assertion message.
*
- * @param expected The expected value.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param expected The expected value.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertEquals(String expected, Element elem, String xpath)
+ public static void assertEquals(String expected, Node node, String xpath)
{
- assertEquals(xpath, expected, elem, new XPathWrapper(xpath));
+ assertEquals(xpath, expected, node, new XPathWrapper(xpath));
}
/**
* Asserts that the specified XPath selects a particular String value.
*
- * @param message Message to display if assertion fails.
- * @param expected The expected value.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param expected The expected value.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
public static void assertEquals(
- String message, String expected, Element elem, String xpath)
+ String message, String expected, Node node, String xpath)
{
- assertEquals(message, expected, elem, new XPathWrapper(xpath));
+ assertEquals(message, expected, node, new XPathWrapper(xpath));
}
/**
* Asserts that the specified XPath selects a particular String value.
- * This variant uses the <code>XPathWrapper</code> class to allow
- * more complex paths, including namespace bindings.
- * <p>
- * Will display the XPath if assertion fails.
+ * This variant uses {@link net.sf.practicalxml.xpath.XPathWrapper} to
+ * allow complex paths, including namespace bindings. Uses the path as
+ * a failed-assertion message.
*
- * @param expected The expected value.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param expected The expected value.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
- public static void assertEquals(String expected, Element elem, XPathWrapper xpath)
+ public static void assertEquals(String expected, Node node, XPathWrapper xpath)
{
- assertEquals(xpath.toString(), expected, elem, xpath);
+ assertEquals(xpath.toString(), expected, node, xpath);
}
/**
* Asserts that the specified XPath selects a particular String value.
- * This variant uses the <code>XPathWrapper</code> class to allow
- * more complex paths, including namespace bindings.
+ * This variant uses {@link net.sf.practicalxml.xpath.XPathWrapper} to
+ * allow complex paths, including namespace bindings.
*
- * @param message Message to display if assertion fails.
- * @param expected The expected value.
- * @param elem The element to serve as initial context.
- * @param xpath The path expression.
+ * @param message Message to display if assertion fails.
+ * @param expected The expected value.
+ * @param node Initial context for expression evaluation.
+ * @param xpath Path expression to assert.
*/
public static void assertEquals(
- String message, String expected, Element elem, XPathWrapper xpath)
+ String message, String expected, Node node, XPathWrapper xpath)
{
- Assert.assertEquals(message, expected, xpath.evaluateAsString(elem));
+ Assert.assertEquals(message, expected, xpath.evaluateAsString(node));
}
-}
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|