|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTestCase
nu.xom.tests.XOMTestCase
This class provides utility methods to compare nodes for deep equality in an infoset sense.
Constructor Summary | |
XOMTestCase(java.lang.String name)
Create a new XOMTestCase with the specified name. |
Method Summary | |
static void |
assertEquals(Attribute expected,
Attribute actual)
Asserts that two attribute nodes are equal. |
static void |
assertEquals(Comment expected,
Comment actual)
Asserts that two comment nodes are equal. |
static void |
assertEquals(DocType expected,
DocType actual)
Asserts that two DocType nodes are equal. |
static void |
assertEquals(Document expected,
Document actual)
Asserts that two document nodes are equal. |
static void |
assertEquals(Element expected,
Element actual)
Asserts that two element nodes are equal. |
static void |
assertEquals(Node expected,
Node actual)
Asserts that two nodes are equal. |
static void |
assertEquals(ProcessingInstruction expected,
ProcessingInstruction actual)
Asserts that two processing instruction nodes are equal. |
static void |
assertEquals(java.lang.String message,
Attribute expected,
Attribute actual)
Asserts that two attribute nodes are equal. |
static void |
assertEquals(java.lang.String message,
Comment expected,
Comment actual)
Asserts that two comment nodes are equal. |
static void |
assertEquals(java.lang.String message,
DocType expected,
DocType actual)
Asserts that two DocType nodes are equal. |
static void |
assertEquals(java.lang.String message,
Document expected,
Document actual)
Asserts that two document nodes are equal. |
static void |
assertEquals(java.lang.String message,
Element expected,
Element actual)
Asserts that two element nodes are equal. |
static void |
assertEquals(java.lang.String message,
Node expected,
Node actual)
Asserts that two nodes are equal. |
static void |
assertEquals(java.lang.String message,
ProcessingInstruction expected,
ProcessingInstruction actual)
Asserts that two processing instruction nodes are equal. |
static void |
assertEquals(java.lang.String message,
Text expected,
Text actual)
Asserts that two text nodes are equal. |
static void |
assertEquals(Text expected,
Text actual)
Asserts that two text nodes are equal. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XOMTestCase(java.lang.String name)
Create a new XOMTestCase with the specified name.
Method Detail |
public static void assertEquals(Text expected, Text actual)
Asserts that two text nodes are equal. Text nodes are considered
equal if they are identical char by char, or if both are null.
Unicode and whitespace normalization is not performed before
comparison. If the two nodes are not equal a
ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Text
nodes
are not equalpublic static void assertEquals(java.lang.String message, Text expected, Text actual)
Asserts that two text nodes are equal. Text nodes are considered
equal if they are identical char by char, or if both are null.
Unicode and whitespace normalization is not performed before
comparison. If the two nodes are not equal a
ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Text
nodes
are not equalpublic static void assertEquals(Attribute expected, Attribute actual)
Asserts that two attribute nodes are equal.
Attribute nodes are considered equal if their
qualified names, namespace URIs, and values
are equal. The type is not considered because it tends not to
survive a roundtrip. If the two nodes are not equal a
ComparisonFailure
is thrown.
There is special handling for the xml:base
attribute. In order to faciliate comparison between relative and
absolute URIs, two xml:base
attributes are
considered equal if one might be a relative form of the other.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Attribute
nodes
are not equalpublic static void assertEquals(java.lang.String message, Attribute expected, Attribute actual)
Asserts that two attribute nodes are equal.
Attribute nodes are considered equal if their
qualified names, namespace URIs, and values
are equal. The type is not considered because this tends not to
survive a roundtrip. If the two nodes are not equal a
ComparisonFailure
is thrown with the given
message.
There is special handling for the xml:base
attribute. In order to faciliate comparison between relative and
absolute URIs, two xml:base
attributes are
considered equal if one might be a relative form of the other.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Attribute
nodes
are not equalpublic static void assertEquals(DocType expected, DocType actual)
Asserts that two DocType nodes are equal.
DocType nodes are considered equal if their
root element name, public ID, and system ID
are equal. The internal DTD subset is not considered.
If the two nodes are not equal a
ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the DocType
nodes
are not equalpublic static void assertEquals(java.lang.String message, DocType expected, DocType actual)
Asserts that two DocType nodes are equal.
DocType nodes are considered equal if their
root element name, public ID, and system ID
are equal. The internal DTD subset is not considered.
If the two nodes are not equal a
ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the DocType
nodes
are not equalpublic static void assertEquals(Element expected, Element actual)
Asserts that two element nodes are equal.
Element nodes are considered equal if their
qualified names, namespace URI, attributes,
declared namespaces, and children
are equal. Consecutive text node children are coalesced
before the comparison is made. If the two nodes are not equal,
a ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Elements
nodes
are not equalpublic static void assertEquals(java.lang.String message, Element expected, Element actual)
Asserts that two element nodes are equal.
Element nodes are considered equal if their
qualified names, namespace URI, attributes,
declared namespaces, and children
are equal. Consecutive text node children are coalesced
before the comparison is made. If the two nodes are not equal,
a ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Element
nodes
are not equalpublic static void assertEquals(java.lang.String message, Document expected, Document actual)
Asserts that two document nodes are equal.
Document nodes are considered equal if their
children are equal. If the two nodes are not equal,
a ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Document
nodes
are not equalpublic static void assertEquals(Document expected, Document actual)
Asserts that two document nodes are equal.
Document nodes are considered equal if their
children are equal. If the two nodes are not equal,
a ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Document
nodes
are not equalpublic static void assertEquals(java.lang.String message, Comment expected, Comment actual)
Asserts that two comment nodes are equal. Comemnt nodes are considered
equal if they are identical char by char, or if both are null.
Unicode and whitespace normalization is not performed before
comparison. If the two nodes are not equal a
ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Comment
nodes
are not equalpublic static void assertEquals(Comment expected, Comment actual)
Asserts that two comment nodes are equal. Comemnt nodes are considered
equal if they are identical char by char, or if both are null.
Unicode and whitespace normalization is not performed before
comparison. If the two nodes are not equal a
ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the Comment
nodes
are not equalpublic static void assertEquals(ProcessingInstruction expected, ProcessingInstruction actual)
Asserts that two processing instruction nodes are equal.
Processing instruction nodes are considered
equal if they have the same target and the same value.
If the two nodes are not equal a
ComparisonFailure
is thrown.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the
ProcessingInstruction
nodes are not equalpublic static void assertEquals(java.lang.String message, ProcessingInstruction expected, ProcessingInstruction actual)
Asserts that two processing instruction nodes are equal.
Processing instruction nodes are considered
equal if they have the same target and the same value.
If the two nodes are not equal a
ComparisonFailure
is thrown with the given
message.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the
ProcessingInstruction
nodes are not equalpublic static void assertEquals(Node expected, Node actual)
Asserts that two nodes are equal. If the two nodes are not
equal a ComparisonFailure
is thrown.
The subclass is not considered. The basic XOM class
is considered, but the subclass is not. For example,
a Text
object can be equal to an object that
is an HTMLText
, but it can never be equal to
a Comment
.
expected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the nodes are not equalpublic static void assertEquals(java.lang.String message, Node expected, Node actual)
Asserts that two nodes are equal. If the two nodes are not
equal a ComparisonFailure
is thrown with the given
message. The subclass is not considered. The basic XOM class
is considered, but the subclass is not. For example,
a Text
object can be equal to an object that
is an HTMLText
, but it can never be equal to
a Comment
.
message
- printed if the nodes are not equalexpected
- the node the test should produceeactual
- the node the test does produce
ComparisonException
- if the nodes are not equal
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |