You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. java:type:: public abstract class DAOTest<T extends DataSourceDAO> extends UnitTest<T>
The \ ``DAOTest``\ is base class for testing DAO.
:author: Twinsen Tsang
:param <T>: The class which implements DataSourceDAO.
**See also:** :java:ref:`DataSourceDAO`
Fields
CREATE_SQL_SUFFIX
.. java:field:: public static final String CREATE_SQL_SUFFIX
:outertype: DAOTest
DROP_SQL_SUFFIX
.. java:field:: public static final String DROP_SQL_SUFFIX
:outertype: DAOTest
INSERT_SQL_SUFFIX
.. java:field:: public static final String INSERT_SQL_SUFFIX
:outertype: DAOTest
MODULE_XML_DESCRIPTOR_SUFFIX
.. java:field:: public static final String MODULE_XML_DESCRIPTOR_SUFFIX
:outertype: DAOTest
.. java:constructor:: public DAOTest()
:outertype: DAOTest
Create an instance of \ ``DAOTest``\ . By default, it disable JMOCK features for reducing dependency.
DAOTest
.. java:constructor:: public DAOTest(boolean noMocking)
:outertype: DAOTest
Create an instance of \ ``DAOTest``\ .
:param noMocking: the flag representing the test requires object mocking or not ?
Methods
commitSQL
.. java:method:: protected void commitSQL(String fixtureName) throws Exception
:outertype: DAOTest
This is a helper function for commit SQL from Fixture.
createDAOContainer
.. java:method:: public Module createDAOContainer() throws Exception
:outertype: DAOTest
This is the factory to create the DAO container (typically it is a common module). Sub-class may override this to customize the DAO container.
dropTable
.. java:method:: public synchronized void dropTable() throws Exception
:outertype: DAOTest
Drop the table for next test-case.
getTableName
.. java:method:: public abstract String getTableName()
:outertype: DAOTest
Return the DB table name accessed by this DAO.
:return: the DB table name accessed by this DAO.
getTestContainer
.. java:method:: public Module getTestContainer()
:outertype: DAOTest
initTestTarget
.. java:method:: @SuppressWarnings public synchronized void initTestTarget() throws Exception
:outertype: DAOTest
Initialize the test target for this test-case. A Special piazza common module is constructed during this initialization. We will call the module as a container of our test-case because the \ ``DAO``\ can only be constructed through \ ``DAOFactory``\ . Moreover, we have to create the database table and insert some SQL for testing because of non-persistence database has been adopted for performing unit-testing.
tearDown
.. java:method:: @Override public void tearDown() throws Exception
:outertype: DAOTest