Class IpsTestCaseBase

java.lang.Object
org.faktorips.runtime.test.IpsTest2
org.faktorips.runtime.test.IpsTestCaseBase
Direct Known Subclasses:
IpsFormulaTestCase, IpsTestCase2

public abstract class IpsTestCaseBase extends IpsTest2
Author:
Joerg Ortmann
  • Constructor Details

    • IpsTestCaseBase

      public IpsTestCaseBase(String qName)
  • Method Details

    • run

      public void run(IpsTestResult result)
      Specified by:
      run in class IpsTest2
    • executeBusinessLogic

      public abstract void executeBusinessLogic() throws Exception
      Method to execute the business logic.
      Throws:
      Exception
    • executeAsserts

      public abstract void executeAsserts(IpsTestResult result) throws Exception
      Method to execute several asserts and store the results in the given result object.
      Throws:
      Exception
    • assertEquals

      protected void assertEquals(Object expectedValue, Object actualValue, IpsTestResult result)
      Asserts that two objects are equal. If they are not equal an ips test failure will be added to the given result object.
      Parameters:
      expectedValue - the expected value
      actualValue - the value which will be compared with the expected value
      result - result object to which the assert result will be added
    • assertEquals

      protected void assertEquals(Object expectedValue, Object actualValue, IpsTestResult result, String testObject, String attribute)
      Asserts that two objects are equal. If they are not equal an ips test failure will be added to the given result object. The given object and attribute specifies the tested field.
      Parameters:
      expectedValue - the expected value
      actualValue - the value which will be compared with the expected value
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
    • assertEquals

      protected void assertEquals(Object expectedValue, Object actualValue, IpsTestResult result, String testObject, String attribute, String message)
      Asserts that two objects are equal. If they are not equal an ips test failure will be added to the given result object with the given message. The given object and attribute specifies the tested field.
      Parameters:
      expectedValue - the expected value
      actualValue - the value which will be compared with the expected value
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the assert
    • assertTrue

      protected void assertTrue(boolean condition, IpsTestResult result)
      Asserts that a condition is true. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
    • assertTrue

      protected void assertTrue(boolean condition, IpsTestResult result, String testObject, String attribute)
      Asserts that a condition is true. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
    • assertTrue

      protected void assertTrue(boolean condition, IpsTestResult result, String testObject, String attribute, String message)
      Asserts that a condition is true. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the assert
    • assertFalse

      protected void assertFalse(boolean condition, IpsTestResult result)
      Asserts that a condition is false. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
    • assertFalse

      protected void assertFalse(boolean condition, IpsTestResult result, String testObject, String attribute)
      Asserts that a condition is false. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
    • assertFalse

      protected void assertFalse(boolean condition, IpsTestResult result, String testObject, String attribute, String message)
      Asserts that a condition is false. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      condition - the condition which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the assert
    • assertNull

      protected void assertNull(Object object, IpsTestResult result)
      Asserts that an object is null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
    • assertNull

      protected void assertNull(Object object, IpsTestResult result, String testObject, String attribute)
      Asserts that an object is null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
    • assertNull

      protected void assertNull(Object object, IpsTestResult result, String testObject, String attribute, String message)
      Asserts that an object is null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the assert
    • assertNotNull

      protected void assertNotNull(Object object, IpsTestResult result)
      Asserts that an object is not null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
    • assertNotNull

      protected void assertNotNull(Object object, IpsTestResult result, String testObject, String attribute)
      Asserts that an object is not null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
    • assertNotNull

      protected void assertNotNull(Object object, IpsTestResult result, String testObject, String attribute, String message)
      Asserts that an object is not null. If it isn't an ips test failure will be added to the given result object.
      Parameters:
      object - the object which will be checked
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object which will be checked. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute which will be checked, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the assert
    • assertEqualsIgnoreScale

      @Deprecated protected void assertEqualsIgnoreScale(org.faktorips.values.Decimal expectedValue, org.faktorips.values.Decimal actualValue, IpsTestResult result)
      Deprecated.
      Decimal class already ignores the scale in it's equals method.
      Asserts that an object is equal with ignored scale (e.g. 2.0 and 2.00 are equal with ignored scale). If it isn't an ips test failure will be added to the given result object.
    • assertEqualsIgnoreScale

      @Deprecated protected void assertEqualsIgnoreScale(org.faktorips.values.Decimal expectedValue, org.faktorips.values.Decimal actualValue, IpsTestResult result, String object, String attribute)
      Deprecated.
      Decimal class already ignores the scale in it's equals method.
      Asserts that an object is equal with ignored scale (e.g. 2.0 and 2.00 are equal with ignored scale). If it isn't an ips test failure will be added to the given result object.
    • assertEqualsIgnoreScale

      @Deprecated protected void assertEqualsIgnoreScale(org.faktorips.values.Decimal expectedValue, org.faktorips.values.Decimal actualValue, IpsTestResult result, String object, String attribute, String message)
      Deprecated.
      Decimal class already ignores the scale in it's equals method.
      Asserts that an object is equal with ignored scale (e.g. 2.0 and 2.00 are equal with ignored scale). If it isn't an ips test failure will be added to the given result object.
    • fail

      protected void fail(Object expectedValue, Object actualValue, IpsTestResult result, String testObject, String attribute, String message)
      Adds a new failure to the given result.
      Parameters:
      expectedValue - the expected value
      actualValue - the actuel value
      result - result object to which the assert result will be added
      testObject - name of the test object in the test case type definition, identifies the object. If the test contains several instances with the same name then an index (starting with 0) must be added to the testObject string separated by "#" (e.g. TestObject#0, TestObject#1, ...). If the test object is a child object then the complete path to the object must be given, the path elements must be separated by "." (e.g. RootTestObject#0.ParentObject#0.ChildObject#0)
      attribute - name of the test attribute in the test case type definition, identifies the attribute, if the test object doesn't support attributes then this parameter could be null
      message - an optional message test to describe the failure