Skip to content

Releases: camassia-io/spring-boot-test-dbunit

Allow Java 11 consumers

25 Mar 11:52
Compare
Choose a tag to compare

Ensures the full project lifecycle is done with Java 11 to avoid any discrepancies in target version

Allow Java 11 consumers

25 Mar 10:41
3bcdd1d
Compare
Choose a tag to compare

Reduces the Target Compatibility version down to Java 11

Maven Central Release

11 Mar 14:35
Compare
Choose a tag to compare

Publishes the project to Sonatype Nexus (Maven Central)

Improved Support for Default use & clearing of tables

05 Oct 13:43
Compare
Choose a tag to compare

Rows in Tables can now be created using only defaults e.g.

dbunit.givenDataSet(
  Table(
    "table-name",
    Row(emptyList())
  )
)

or for file based:

<?xml version="1.0" encoding="UTF-8"?>
<dataset>
    <demo id="[ID]" name="[NAME]"/> // All columns need to be specified
</dataset>

As long as there is a default configured for each mandatory column in 'table-name' then a row will be created using those


Tables can also be cleared programatically using

dbunit.givenDataSet(
  Table("table-name")     // Or Table("table-name", emptyList())
)

Support DatabaseSetup and Teardown annotations on nested class hierarchy

01 Feb 13:27
Compare
Choose a tag to compare

When using a test class hierarchy, previously only the test method + class containing the test method could be annotated with @DatabaseSetup or @DatabaseTeardown.
As of this change the parent, grandparent, great grandparent etc of the test method can have the annotations too.

Remember to use the operation = DatabaseOperation.INSERT option on child level annotations though if adding to the same table at different stages.
This stops the data already in the table getting wiped once a new operation on that table is made at a lower level.

Templated val improvements

28 Jul 15:36
Compare
Choose a tag to compare

Improves the conventions for templated vals

  • Doesn't treat json arrays as a templated variable name
  • Templated variable names now need to follow a certain pattern [A-Za-z0-9_\-]+

Error or emit Warn log if an Override isn't used

28 Jul 11:04
Compare
Choose a tag to compare

By default going forwards if a user specifies an Override that isn't used then an exception will be thrown.
This can be changed to a warn log with spring.dbunit.fail_on_unused_overrides=false

This should help avoid & highlight typos in tests

Version upgrades

10 May 08:45
Compare
Choose a tag to compare

Java 17, Gradle 7.4.2, dbunit 2.7.3

Bug fix for when a missing Override fell back to a null default

24 Jan 13:58
Compare
Choose a tag to compare

Previously an exception would be thrown. Now the null default is used.

Introduce the concept of Extensions & Filename replacement

11 Jan 09:33
Compare
Choose a tag to compare

Extensions

Builds on Table Defaults & Overrides to streamline how they work.

These are configured by default but can be overridden using Beans

@Bean
    @ConditionalOnMissingBean
    fun extensions(
        resourceLoader: ResourceLoader,
        defaults: List<TableDefaults>,
        config: DatabaseConfig
    ): Extensions {
        val dbDefaults = Defaults(defaults, !(config.getProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES) as Boolean))
        return Extensions(
            listOf(
                // Resolves all known templates and ignores unknowns for further processing
                TemplatedCellMappingExtension,
                // Replaces all [null]s will null
                NullCellMappingExtension,
                // Resolves all file replacements
                ResourceBasedValueCellMappingExtension(resourceLoader),
                // Resolves all remaining templates and uses global defaults for any missing values in the form [.*]
                DefaultTemplatedCellMappingExtension(dbDefaults)
            ),
            dbDefaults
        )
    }

File name replacement

You can now have a column value of [file:{somefilename.xyz}] and Db Unit will use the File Loader to load the content of the file

e.g. [file:xyz.txt]