|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.framework.tools.testing.EntityTestUnit
public abstract class EntityTestUnit
A class for unit testing domain entities.
Constructor Summary | |
---|---|
EntityTestUnit()
Instantiates a new EntityTestUnit. |
Method Summary | |
---|---|
protected void |
doSetUp()
Override to provide specific setup for this test |
protected void |
doTearDown()
Override to provide specific tear down for this test |
protected EntityConnection |
getConnection()
|
protected EntityConnectionProvider |
getConnectionProvider()
|
protected Entity |
getReferenceEntity(String entityID)
|
protected User |
getTestUser()
Returns the database user to use when running the tests, this default implementation prompts for the user/password information, usually overridden |
protected EntityConnectionProvider |
initializeConnectionProvider()
|
protected void |
initializeReferencedEntities(String testEntityID,
String entityID)
This method should initialize instances of entities specified by the entityIDs found in the entityIDs Collection and map them to their respective entityIDs via the setReferenceEntity method |
protected Entity |
initializeReferenceEntity(String entityID)
Initializes a new Entity of the given type, by default this method creates a Entity filled with random values. |
protected Entity |
initializeTestEntity(String entityID)
This method should return an instance of the entity specified by entityID |
protected abstract void |
loadDomainModel()
This method should load the domain model, for example by instantiating the domain model class or simply loading it by name |
protected void |
modifyEntity(Entity testEntity)
This method should return testEntity in a modified state |
protected void |
setReferenceEntity(String entityID,
Entity entity)
Maps the given reference entity to the given entityID |
void |
setUp()
Sets up the database connection |
void |
tearDown()
Tears down the database connection |
void |
testEntity(String entityID)
Runs the insert/update/select/delete tests for the given entityID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntityTestUnit()
Method Detail |
---|
public final void setUp() throws CancelException
CancelException
- in case the test is cancelled during setuppublic final void tearDown()
public final void testEntity(String entityID) throws DatabaseException
entityID
- the ID of the entity to test
DatabaseException
- in case of an exceptionprotected void doSetUp()
protected void doTearDown()
protected EntityConnectionProvider initializeConnectionProvider() throws CancelException
CancelException
- in case the login was cancelledprotected User getTestUser() throws CancelException
CancelException
- in case the user cancels the loginprotected final EntityConnectionProvider getConnectionProvider()
protected final EntityConnection getConnection()
protected final Entity getReferenceEntity(String entityID)
entityID
- the entityID of the the reference entity to retrieve
setReferenceEntity(String, org.jminor.framework.domain.Entity)
protected final void setReferenceEntity(String entityID, Entity entity) throws DatabaseException
entityID
- the entityIDentity
- the reference entity to map to the given entityID
DatabaseException
- in case of an exceptiongetReferenceEntity(String)
protected abstract void loadDomainModel()
protected Entity initializeTestEntity(String entityID)
entityID
entityID
- the entityID for which to initialize an entity instance
protected Entity initializeReferenceEntity(String entityID)
entityID
- the entity ID
protected void modifyEntity(Entity testEntity)
testEntity
in a modified state
testEntity
- the entity to modifyprotected final void initializeReferencedEntities(String testEntityID, String entityID) throws DatabaseException
entityIDs
Collection and map them to their respective entityIDs via the setReferenceEntity method
testEntityID
- the ID of the entity being testedentityID
- the ID of the entity for which to initialize the referenced entities
DatabaseException
- in case of an exceptionsetReferenceEntity(String, org.jminor.framework.domain.Entity)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |