Version: 1.1.1

org.biomoby.shared
Class MobyUnitTest

java.lang.Object
  extended by org.biomoby.shared.MobyUnitTest

public class MobyUnitTest
extends Object

A class representing a moby unit test. In addition, this class has methods to perform the various tests required for unit testing moby services.

Version:
$Id: MobyUnitTest.java,v 1.3 2009/02/03 16:39:41 kawas Exp $
Author:
Wendy Alexander, Eddie Kawas

Constructor Summary
MobyUnitTest()
          Default Constructor - creates a blank MobyUnitTest object
 
Method Summary
 boolean compareOutputXML(String testXML)
          XML is assumed to be wellformed and valid.
 boolean compareXmlWithREGEX(String testXML, boolean multiline)
           
 boolean compareXmlWithXpath(String testXML)
           
 String getExampleInput()
          Getter: get the example input that you can use to invoke this service
 String getValidOutputXML()
          Getter: get the expected XML output for this service (usually by sending it the input from getExampleInput()
 String getValidREGEX()
          Getter: get the Regular Expression for this unit test
 String getValidXPath()
          Getter: get the xpath expression for this unit test
 String getXMLDifferences(String testXML)
           
 void setExampleInput(String exampleInput)
          Setter: set the example input that can be passed to the service to invoke it
 void setValidOutputXML(String validOutputXML)
          Setter: set the expected XML output for this serivce
 void setValidREGEX(String validREGEX)
          Setter: set the regular expression for this unit test
 void setValidXPath(String validXPath)
          Setter: set the xpath expression for this unit test
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MobyUnitTest

public MobyUnitTest()
Default Constructor - creates a blank MobyUnitTest object

Method Detail

getExampleInput

public String getExampleInput()
Getter: get the example input that you can use to invoke this service

Returns:
a string of XML representing a services example input

setExampleInput

public void setExampleInput(String exampleInput)
Setter: set the example input that can be passed to the service to invoke it

Parameters:
exampleInput - a string of XML representing a services example input

getValidOutputXML

public String getValidOutputXML()
Getter: get the expected XML output for this service (usually by sending it the input from getExampleInput()

Returns:
a string of XML representing a services expected output

setValidOutputXML

public void setValidOutputXML(String validOutputXML)
Setter: set the expected XML output for this serivce

Parameters:
validOutputXML - a string of XML representing a services expected output

getValidREGEX

public String getValidREGEX()
Getter: get the Regular Expression for this unit test

Returns:
a regular expression that can be used on a services output to determine validity

setValidREGEX

public void setValidREGEX(String validREGEX)
Setter: set the regular expression for this unit test

Parameters:
validREGEX - a regular expression that can be used on a services output to determine validity

getValidXPath

public String getValidXPath()
Getter: get the xpath expression for this unit test

Returns:
an xpath expression that can be used to drill into a services output

setValidXPath

public void setValidXPath(String validXPath)
Setter: set the xpath expression for this unit test

Parameters:
validXPath - an xpath expression that can be used to drill into a services output

toString

public String toString()
Overrides:
toString in class Object

compareOutputXML

public boolean compareOutputXML(String testXML)
                         throws MobyException
XML is assumed to be wellformed and valid. Comparing 'XML' that is not wellformed may be identical but this method will return false!

Parameters:
testXML - the XML that you would like to compare to XML obtained from getValidOutputXML()
Returns:
true if the documents are semantically similar, false otherwise
Throws:
MobyException - if there is a problem reading/parsing the testXML

compareXmlWithXpath

public boolean compareXmlWithXpath(String testXML)
                            throws MobyException
Parameters:
testXML - the XML that you would like to test the XPATH, from getValidXPath(), expression against
Returns:
true if the XPath expression matches at least one node in the testXML
Throws:
MobyException - if there is a problem compiling the XPATH expression, or reading/parsing the textXML

compareXmlWithREGEX

public boolean compareXmlWithREGEX(String testXML,
                                   boolean multiline)
Parameters:
testXML - the XML that you would like to test the REGEX, from getValidREGEX(), expression against
Returns:
true if the regular expression matches the testXML, false otherwise.

getXMLDifferences

public String getXMLDifferences(String testXML)
Parameters:
testXML - the XML that you would like to 'diff' to XML obtained from getValidOutputXML()
Returns:
a String of text outlining all of the differences

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010