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 Details

    • readTestEntityFile

      void readTestEntityFile(org.springframework.data.repository.CrudRepository<TestEntity,Long> repository) throws Exception
      Read a file with information about TestEntity objects 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 Exception
      Read one or more files with information about SbUnitTestEntity objects 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 Exception
      Try to read TestEntity information from a file with DeUnitTestEntity object 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 Exception
      Read a file with information about TestEntity objects, but with the name attribute misspelled as namex.
      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 Exception
      Read a file with information about TestEntity objects, but missing the id attribute.
      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 Exception
      Try to read TestEntity information 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

      @Test default void readFileForSimpleEntity() throws Exception
      Throws:
      Exception
    • readFileForEntityWithAssociations

      @Test default void readFileForEntityWithAssociations() throws Exception
      Throws:
      Exception
    • readFileForEntityWithMissingAssociations

      @Test default void readFileForEntityWithMissingAssociations() throws Exception
      Throws:
      Exception
    • readWrongTypeOfFile

      @Test default void readWrongTypeOfFile() throws Exception
      Throws:
      Exception
    • readFileWithIncorrectAttribute

      @Test default void readFileWithIncorrectAttribute() throws Exception
      Throws:
      Exception
    • readFileWithoutIdAttributeAndNoPrimaryKeyGenerator

      @Test default void readFileWithoutIdAttributeAndNoPrimaryKeyGenerator() throws Exception
      Throws:
      Exception
    • readNonExistingFile

      @Test default void readNonExistingFile() throws Exception
      Throws:
      Exception
    • verifyEntity

      static void verifyEntity(TestEntity expected, TestEntity actual)
    • verifyEntity

      static void verifyEntity(DbUnitTestEntity expected, DbUnitTestEntity actual)
    • verifyEntity

      static void verifyEntity(TestEntityWithoutRepository expected, @Nullable TestEntityWithoutRepository actual)