Package org.fastnate.generator.test.ids
Class IdsTest
java.lang.Object
org.fastnate.generator.test.AbstractEntitySqlGeneratorTest
org.fastnate.generator.test.ids.IdsTest
- Direct Known Subclasses:
RelativeIdsTest
Tests that ids of entities are written correctly.
The test for writing an embbeded id is located in
EmbeddedTest.- Author:
- Tobias Liefke
-
Field Summary
Fields inherited from class org.fastnate.generator.test.AbstractEntitySqlGeneratorTest
WRITER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTests to write an entity with just the generated ID.voidTests to write entities with fixed ids.voidTests to write an entity with an identity column.protected <E extends IdTestEntity<E>>
ETests to write entities of the given class.voidTests to write an entity with a sequence generator.voidTests to write an entity with a sequence generator.voidTests to write an entity with a table generator.Methods inherited from class org.fastnate.generator.test.AbstractEntitySqlGeneratorTest
createQuery, executeSql, findResults, findResults, findSingleResult, findSingleResult, getConnection, getEm, getGenerator, getGeneratorProperties, setup, setup, tearDown, write
-
Constructor Details
-
IdsTest
public IdsTest()
-
-
Method Details
-
testEmptyEntity
Tests to write an entity with just the generated ID.- Throws:
Exception- if Hibernate or the generator throws one
-
testFixedId
Tests to write entities with fixed ids.- Throws:
Exception- if Hibernate or the generator throws one
-
testIdentityGenerator
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 entityentityPrefix- 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 oneSQLException- if there is a problem with some SQLReflectiveOperationException- if we can't create one of the entities
-
testPrimitiveIds
Tests to write an entity with a sequence generator.- Throws:
Exception- if Hibernate or the generator throws one
-
testSequenceGenerator
Tests to write an entity with a sequence generator.- Throws:
Exception- if Hibernate or the generator throws one
-
testTableGenerator
Tests to write an entity with a table generator.- Throws:
Exception- if Hibernate or the generator throws one
-