java.lang.Object
is.codion.framework.domain.test.DomainTest

public class DomainTest extends Object
A class for unit testing a domain model.
  • Constructor Details

    • DomainTest

      public DomainTest(Domain domain)
      Instantiates a new DomainTest, using the user specified by the 'codion.test.user' system property.
      Parameters:
      domain - the domain model
    • DomainTest

      public DomainTest(Domain domain, Function<EntityConnection,DomainTest.EntityFactory> entityFactory)
      Instantiates a new DomainTest.
      Parameters:
      domain - the domain model
      entityFactory - provides the factory used to create test entities
    • DomainTest

      public DomainTest(Domain domain, User user)
      Instantiates a new DomainTest.
      Parameters:
      domain - the domain model
      user - 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 model
      entityFactory - provides the factory used to create test entities
      user - the user to use when running the tests
  • Method Details

    • entities

      public final Entities entities()
      Returns:
      the domain entities
    • test

      public final void test(EntityType entityType)
      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

      protected final EntityConnection connection()
      Returns:
      the EntityConnection instance used by this DomainTest