Class CayenneTestCase

  • All Implemented Interfaces:
    junit.framework.Test
    Direct Known Subclasses:
    H2TestCase

    public class CayenneTestCase
    extends junit.framework.TestCase
    Provides a Cayenne JUnit TestCase which will initialize a new thread local DataContext for each executed test.
    • Constructor Summary

      Constructors 
      Constructor Description
      CayenneTestCase()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assertDateEquals​(Date expected, Date actual)
      Assert the dates are equal ignoring any time differences.
      org.apache.cayenne.access.DataContext getDataContext()
      Return the thread local DataContext.
      protected void setUp()
      This method is called before a test is executed, creating a DataContext and associating it to the current Thread.
      protected void tearDown()
      This method is called after a test is executed, removing the DataContext from the Thread.
      • 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, runTest, setName, toString
    • Constructor Detail

      • CayenneTestCase

        public CayenneTestCase()
    • Method Detail

      • getDataContext

        public org.apache.cayenne.access.DataContext getDataContext()
        Return the thread local DataContext.
        Returns:
        the thread local DataContexts
      • setUp

        protected void setUp()
                      throws Exception
        This method is called before a test is executed, creating a DataContext and associating it to the current Thread.
        Overrides:
        setUp in class junit.framework.TestCase
        Throws:
        Exception
        See Also:
        TestCase.setUp()
      • tearDown

        protected void tearDown()
                         throws Exception
        This method is called after a test is executed, removing the DataContext from the Thread.
        Overrides:
        tearDown in class junit.framework.TestCase
        Throws:
        Exception
        See Also:
        TestCase.tearDown()
      • assertDateEquals

        public void assertDateEquals​(Date expected,
                                     Date actual)
        Assert the dates are equal ignoring any time differences.
        Parameters:
        expected - the expected date
        actual - the actual date