com.envoisolutions.sxc.util
Class XoTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.envoisolutions.sxc.util.XoTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class XoTestCase
extends junit.framework.TestCase


Nested Class Summary
static class XoTestCase.NullResolver
           
 
Constructor Summary
XoTestCase()
           
 
Method Summary
 void addNamespace(java.lang.String ns, java.lang.String uri)
          Add a namespace that will be used for XPath expressions.
 org.w3c.dom.NodeList assertInvalid(java.lang.String xpath, org.w3c.dom.Node node)
          Assert that the following XPath query selects no nodes.
 void assertNoFault(org.w3c.dom.Node node)
           
 org.w3c.dom.NodeList assertValid(java.lang.String xpath, org.w3c.dom.Node node)
          Assert that the following XPath query selects one or more nodes.
 void assertXPathEquals(java.lang.String xpath, java.lang.String value, org.w3c.dom.Node node)
          Asser that the text of the xpath node retrieved is equal to the value specified.
static java.lang.String getBasedir()
           
protected  java.io.Reader getResourceAsReader(java.lang.String resource)
           
protected  java.io.InputStream getResourceAsStream(java.lang.String resource)
           
 java.io.File getTestFile(java.lang.String relativePath)
           
protected  javax.xml.stream.XMLStreamReader getXSR(java.io.InputStream is)
           
protected  javax.xml.stream.XMLStreamReader getXSR(java.lang.String string)
           
 org.w3c.dom.Document readDocument(byte[] b)
           
static org.w3c.dom.Document readXml(java.io.InputStream is)
          Read XML as DOM.
 void setUp()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XoTestCase

public XoTestCase()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

getXSR

protected javax.xml.stream.XMLStreamReader getXSR(java.lang.String string)
                                           throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getXSR

protected javax.xml.stream.XMLStreamReader getXSR(java.io.InputStream is)
                                           throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readDocument

public org.w3c.dom.Document readDocument(byte[] b)
                                  throws org.xml.sax.SAXException,
                                         java.io.IOException,
                                         javax.xml.parsers.ParserConfigurationException
Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException

readXml

public static org.w3c.dom.Document readXml(java.io.InputStream is)
                                    throws org.xml.sax.SAXException,
                                           java.io.IOException,
                                           javax.xml.parsers.ParserConfigurationException
Read XML as DOM.

Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException

assertValid

public org.w3c.dom.NodeList assertValid(java.lang.String xpath,
                                        org.w3c.dom.Node node)
                                 throws java.lang.Exception
Assert that the following XPath query selects one or more nodes.

Parameters:
xpath -
Throws:
java.lang.Exception

assertInvalid

public org.w3c.dom.NodeList assertInvalid(java.lang.String xpath,
                                          org.w3c.dom.Node node)
                                   throws java.lang.Exception
Assert that the following XPath query selects no nodes.

Parameters:
xpath -
Throws:
java.lang.Exception

assertXPathEquals

public void assertXPathEquals(java.lang.String xpath,
                              java.lang.String value,
                              org.w3c.dom.Node node)
                       throws java.lang.Exception
Asser that the text of the xpath node retrieved is equal to the value specified.

Parameters:
xpath -
value -
node -
Throws:
java.lang.Exception

assertNoFault

public void assertNoFault(org.w3c.dom.Node node)
                   throws java.lang.Exception
Throws:
java.lang.Exception

addNamespace

public void addNamespace(java.lang.String ns,
                         java.lang.String uri)
Add a namespace that will be used for XPath expressions.

Parameters:
ns - Namespace name.
uri - The namespace uri.

getResourceAsStream

protected java.io.InputStream getResourceAsStream(java.lang.String resource)

getResourceAsReader

protected java.io.Reader getResourceAsReader(java.lang.String resource)

getTestFile

public java.io.File getTestFile(java.lang.String relativePath)

getBasedir

public static java.lang.String getBasedir()


Copyright © 2007-2008 Envoi Solutions LLC. All Rights Reserved.