Class IpsTestCase

  • All Implemented Interfaces:
    junit.framework.Test

    public abstract class IpsTestCase
    extends junit.framework.TestCase
    Base class for IPS test cases.
    Author:
    Jan Ortmann
    • Constructor Summary

      Constructors 
      Constructor Description
      IpsTestCase​(java.lang.String name)
      Creates a new test case.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void execAsserts()
      Compares the actual output (created by the business function) with the expected result.
      protected abstract void execBusinessFcts()
      Executes the business function(s) to test.
      protected javax.xml.parsers.DocumentBuilder getDocumentBuilder()  
      protected abstract void readExpectedResult​(org.w3c.dom.Element expResultEl)
      Reads the expected result from the given Xml element.
      protected abstract void readInput​(org.w3c.dom.Element inputEl)
      Reads the input for the test from the given Xml element.
      protected void run​(org.w3c.dom.Document doc)  
      protected void run​(org.w3c.dom.Element testCaseEl)  
      protected void runTest()
      Implementation of the JUnit Test method that reads the test case data (input, expected output) from the test's resource, executes the business functions and compares the expected result with the actual result.
      • Methods inherited from class junit.framework.TestCase

        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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, setName, setUp, tearDown, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IpsTestCase

        public IpsTestCase​(java.lang.String name)
        Creates a new test case.
    • Method Detail

      • runTest

        protected void runTest()
                        throws java.lang.Throwable
        Implementation of the JUnit Test method that reads the test case data (input, expected output) from the test's resource, executes the business functions and compares the expected result with the actual result.
        Overrides:
        runTest in class junit.framework.TestCase
        Throws:
        java.lang.Throwable
      • run

        protected void run​(org.w3c.dom.Document doc)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • run

        protected void run​(org.w3c.dom.Element testCaseEl)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readInput

        protected abstract void readInput​(org.w3c.dom.Element inputEl)
        Reads the input for the test from the given Xml element.
      • readExpectedResult

        protected abstract void readExpectedResult​(org.w3c.dom.Element expResultEl)
        Reads the expected result from the given Xml element.
      • execBusinessFcts

        protected abstract void execBusinessFcts()
                                          throws java.lang.Exception
        Executes the business function(s) to test.
        Throws:
        java.lang.Exception - Any exception thrown by the business function is considered as an error.
      • execAsserts

        protected abstract void execAsserts()
                                     throws java.lang.Exception
        Compares the actual output (created by the business function) with the expected result.
        Throws:
        java.lang.Exception
      • getDocumentBuilder

        protected javax.xml.parsers.DocumentBuilder getDocumentBuilder()
                                                                throws javax.xml.parsers.ParserConfigurationException
        Throws:
        javax.xml.parsers.ParserConfigurationException