Interface DatabaseReaderTestCases
- All Known Implementing Classes:
CsvDatabaseReaderTest,DbUnitFlatXmlReaderTest
public interface DatabaseReaderTestCases
Defines a set of test cases to be used to test different classes that read text files to populate repositories, e.g.,
DbUnitFlatXmlReader and CsvDatabaseReader.
To use this interface, create a test class that implements it, and implement the various read methods.
- Author:
- RealLifeDeveloper
-
Method Summary
Modifier and TypeMethodDescriptionvoidreadDbUnitTestEntityFiles(org.springframework.data.repository.CrudRepository<DbUnitTestEntity, Integer> repository) Read one or more files with information aboutSbUnitTestEntityobjects and save them in a repository.default voiddefault voiddefault voiddefault voiddefault voiddefault voidvoidreadTestEntityFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) Read a file with information aboutTestEntityobjects and save them in a repository.voidreadTestEntityFileWithIncorrectAttribute(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) Read a file with information aboutTestEntityobjects, but with thenameattribute misspelled asnamex.voidreadTestEntityFileWithNoIdAttribute(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) Read a file with information aboutTestEntityobjects, but missing theidattribute.voidreadTestEntityFromNonExistingFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) Try to readTestEntityinformation from a non-existing file named/no/such/file.voidreadTestEntityFromWrongTypeOfFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) Try to readTestEntityinformation from a file withDeUnitTestEntityobject information.default voidstatic voidverifyEntity(DbUnitTestEntity expected, DbUnitTestEntity actual) static voidverifyEntity(TestEntity expected, TestEntity actual) static voidverifyEntity(TestEntityWithoutRepository expected, @Nullable TestEntityWithoutRepository actual)
-
Method Details
-
readTestEntityFile
void readTestEntityFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) throws ExceptionRead a file with information aboutTestEntityobjects and save them in a repository.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readDbUnitTestEntityFiles
void readDbUnitTestEntityFiles(org.springframework.data.repository.CrudRepository<DbUnitTestEntity, Integer> repository) throws ExceptionRead one or more files with information aboutSbUnitTestEntityobjects and save them in a repository.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readTestEntityFromWrongTypeOfFile
void readTestEntityFromWrongTypeOfFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) throws ExceptionTry to readTestEntityinformation from a file withDeUnitTestEntityobject information.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readTestEntityFileWithIncorrectAttribute
void readTestEntityFileWithIncorrectAttribute(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) throws ExceptionRead a file with information aboutTestEntityobjects, but with thenameattribute misspelled asnamex.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readTestEntityFileWithNoIdAttribute
void readTestEntityFileWithNoIdAttribute(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) throws ExceptionRead a file with information aboutTestEntityobjects, but missing theidattribute.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readTestEntityFromNonExistingFile
void readTestEntityFromNonExistingFile(org.springframework.data.repository.CrudRepository<TestEntity, Long> repository) throws ExceptionTry to readTestEntityinformation from a non-existing file named/no/such/file.- Parameters:
repository- the repository in which to save the entities- Throws:
Exception- if something goes wrong
-
readFileForSimpleEntity
- Throws:
Exception
-
readFileForEntityWithAssociations
- Throws:
Exception
-
readFileForEntityWithMissingAssociations
- Throws:
Exception
-
readWrongTypeOfFile
- Throws:
Exception
-
readFileWithIncorrectAttribute
- Throws:
Exception
-
readFileWithoutIdAttributeAndNoPrimaryKeyGenerator
- Throws:
Exception
-
readNonExistingFile
- Throws:
Exception
-
verifyEntity
-
verifyEntity
-
verifyEntity
static void verifyEntity(TestEntityWithoutRepository expected, @Nullable TestEntityWithoutRepository actual)
-