Class BaseTestCase

  • All Implemented Interfaces:
    junit.framework.Test

    public class BaseTestCase
    extends junit.framework.TestCase
    An extension of junit.framework.TestCase that adds those methods that we really wish were part of JUnit.
    Version:
    $Revision: 1.4 $
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseTestCase​(java.lang.String name)
      Create an instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertCollectionsEqual​(java.util.Collection a, java.util.Collection b)
      Assert that the two collections are the same irrespective of order.
      static void assertFalse​(boolean condition)
      Assert that the specified condition is false.
      static void assertFalse​(java.lang.String description, boolean condition)
      Assert that the specified condition is false.
      void assertInstanceOf​(java.lang.Object object, java.lang.Class clazz)
      Assert that the specified object is an instance of this class
      void assertInstanceOf​(java.lang.String label, java.lang.Object object, java.lang.Class clazz)
      Assert that the specified object is an instance of this class
      static void assertSame​(java.lang.Object a, java.lang.Object b)
      Assert that the two objects are the same.
      static void assertSame​(java.lang.String description, java.lang.Object a, java.lang.Object b)
      Assert that the two objects are the same.
      void notImplemented()
      Convenience method to signal that this test hasn't been finished yet.
      • 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, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
      • Methods inherited from class java.lang.Object

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

      • BaseTestCase

        public BaseTestCase​(java.lang.String name)
        Create an instance
        Parameters:
        name - The name of the test
    • Method Detail

      • notImplemented

        public void notImplemented()
        Convenience method to signal that this test hasn't been finished yet. This will print the name of the test to System.out.
      • assertCollectionsEqual

        public void assertCollectionsEqual​(java.util.Collection a,
                                           java.util.Collection b)
        Assert that the two collections are the same irrespective of order.
        Parameters:
        a - The first collection
        b - The second collection
      • assertSame

        public static void assertSame​(java.lang.String description,
                                      java.lang.Object a,
                                      java.lang.Object b)
        Assert that the two objects are the same. Junit has a method like this however it does not display what the two objects are. This method will display the toString() representations of the two objects in the case that the assertion fails.
        Parameters:
        description - The failure message to use if the two objects are not the same.
        a - The first object to compare.
        b - The second object to compare.
      • assertSame

        public static void assertSame​(java.lang.Object a,
                                      java.lang.Object b)
        Assert that the two objects are the same. Junit has a method like this however it does not display what the two objects are. This method will display the toString() representations of the two objects in the case that the assertion fails.
        Parameters:
        a - The first object to compare.
        b - The second object to compare.
      • assertFalse

        public static void assertFalse​(java.lang.String description,
                                       boolean condition)
        Assert that the specified condition is false. Older versions of junit have assertTrue() but not assertFalse so we add it here to be sure that it is present.
        Parameters:
        description - The failure message to be used if the condition is not false.
        condition - The value to check.
      • assertFalse

        public static void assertFalse​(boolean condition)
        Assert that the specified condition is false. Older versions of junit have assertTrue() but not assertFalse so we add it here to be sure that it is present.
        Parameters:
        condition - The value to check.
      • assertInstanceOf

        public void assertInstanceOf​(java.lang.String label,
                                     java.lang.Object object,
                                     java.lang.Class clazz)
        Assert that the specified object is an instance of this class
        Parameters:
        label - A description of the test
        object - The object to test
        clazz - The class
      • assertInstanceOf

        public void assertInstanceOf​(java.lang.Object object,
                                     java.lang.Class clazz)
        Assert that the specified object is an instance of this class
        Parameters:
        object - The object to test
        clazz - The class