java.lang.Object
is.codion.framework.domain.test.DomainTest
A class for unit testing a domain model.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Handles creating and modifying entities used for testing. -
Constructor Summary
ConstructorDescriptionDomainTest
(Domain domain) Instantiates a new DomainTest, using the user specified by the 'codion.test.user' system property.DomainTest
(Domain domain, User user) Instantiates a new DomainTest.DomainTest
(Domain domain, Function<EntityConnection, DomainTest.EntityFactory> entityFactory) Instantiates a new DomainTest.DomainTest
(Domain domain, Function<EntityConnection, DomainTest.EntityFactory> entityFactory, User user) Instantiates a new DomainTest. -
Method Summary
Modifier and TypeMethodDescriptionprotected final EntityConnection
final Entities
entities()
final void
test
(EntityType entityType) Runs the insert/update/select/delete tests for the given entityType
-
Constructor Details
-
DomainTest
Instantiates a new DomainTest, using the user specified by the 'codion.test.user' system property.- Parameters:
domain
- the domain model
-
DomainTest
Instantiates a new DomainTest.- Parameters:
domain
- the domain modelentityFactory
- provides the factory used to create test entities
-
DomainTest
Instantiates a new DomainTest.- Parameters:
domain
- the domain modeluser
- the user to use when running the tests
-
DomainTest
public DomainTest(Domain domain, Function<EntityConnection, DomainTest.EntityFactory> entityFactory, User user) Instantiates a new DomainTest.- Parameters:
domain
- the domain modelentityFactory
- provides the factory used to create test entitiesuser
- the user to use when running the tests
-
-
Method Details
-
entities
- Returns:
- the domain entities
-
test
Runs the insert/update/select/delete tests for the given entityType- Parameters:
entityType
- the type of the entity to test- Throws:
DatabaseException
- in case of an exception
-
connection
- Returns:
- the EntityConnection instance used by this DomainTest
-