com.banda.serverbase.test
Class AbstractDaoTest<T,PK extends Serializable>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.banda.serverbase.test.Spring4Test
              extended by com.banda.serverbase.test.AbstractDaoTest<T,PK>
Type Parameters:
T - Object handled by DAO
PK - Primary key of object handled by DAO
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
BasicDaoTest

@Transactional
public abstract class AbstractDaoTest<T,PK extends Serializable>
extends Spring4Test

An abstract class that tests the core DAO functionality - getAll, get, exists, save, remove

Since:
2009
Author:
© Peter Banda
See Also:
GenericDAO

Constructor Summary
AbstractDaoTest()
           
 
Method Summary
protected  void assertObjectEquals(T first, T second)
           
protected abstract  GenericDAO<T,PK> getDao()
          Gets the DAO class tested by this class.
protected abstract  PK getExistingTestKey()
          Gets the key existing in database for testing.
protected  PK getKey(T object)
           
protected abstract  T getTestObject()
          Gets the test data for DAO testing.
 void testExists()
           
 void testGet()
           
 void testGetAll()
           
 void testGetLast()
           
 void testRemove()
           
 void testSave()
           
 
Methods inherited from class com.banda.serverbase.test.Spring4Test
assertNotEmpty, createRandomObject, createRandomObjects, reportValues
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDaoTest

public AbstractDaoTest()
Method Detail

testGetAll

public void testGetAll()

testGet

public void testGet()

testGetLast

public void testGetLast()

testExists

public void testExists()

testSave

public void testSave()

assertObjectEquals

protected void assertObjectEquals(T first,
                                  T second)

testRemove

public void testRemove()

getKey

protected PK getKey(T object)

getDao

protected abstract GenericDAO<T,PK> getDao()
Gets the DAO class tested by this class.

Returns:
The DAO class to test

getTestObject

protected abstract T getTestObject()
Gets the test data for DAO testing.

Returns:
The data for testing

getExistingTestKey

protected abstract PK getExistingTestKey()
Gets the key existing in database for testing.

Returns:
The key for testing


Copyright © 2013. All Rights Reserved.