Class IdsTest

Direct Known Subclasses:
RelativeIdsTest

public class IdsTest extends AbstractEntitySqlGeneratorTest
Tests that ids of entities are written correctly. The test for writing an embbeded id is located in EmbeddedTest.
Author:
Tobias Liefke
  • Constructor Details

    • IdsTest

      public IdsTest()
  • Method Details

    • testEmptyEntity

      @Test public void testEmptyEntity() throws Exception
      Tests to write an entity with just the generated ID.
      Throws:
      Exception - if Hibernate or the generator throws one
    • testFixedId

      @Test public void testFixedId() throws Exception
      Tests to write entities with fixed ids.
      Throws:
      Exception - if Hibernate or the generator throws one
    • testIdentityGenerator

      @Test public void testIdentityGenerator() throws Exception
      Tests to write an entity with an identity column.
      Throws:
      Exception - if Hibernate or the generator throws one
    • testIds

      protected <E extends IdTestEntity<E>> E testIds(Class<E> entityClass, String entityPrefix) throws IOException, SQLException, ReflectiveOperationException
      Tests to write entities of the given class.
      Parameters:
      entityClass - the type of the entity
      entityPrefix - an option Prefix for the entity names to allow more than one call of this method
      Returns:
      the first written entity as read by Hibernate
      Throws:
      IOException - if the generator throws one
      SQLException - if there is a problem with some SQL
      ReflectiveOperationException - if we can't create one of the entities
    • testPrimitiveIds

      @Test public void testPrimitiveIds() throws Exception
      Tests to write an entity with a sequence generator.
      Throws:
      Exception - if Hibernate or the generator throws one
    • testSequenceGenerator

      @Test public void testSequenceGenerator() throws Exception
      Tests to write an entity with a sequence generator.
      Throws:
      Exception - if Hibernate or the generator throws one
    • testTableGenerator

      @Test public void testTableGenerator() throws Exception
      Tests to write an entity with a table generator.
      Throws:
      Exception - if Hibernate or the generator throws one