October 2018
Intermediate to advanced
982 pages
23h 29m
English
In this recipe, we relied on the facility that is provided by Spring to initialize and populate the database in order to get our database populated with the data required to run the tests and assert on them. However, we also wanted to be able to use some data that was only relevant to a particular test suite. For this, we turned to the ResourceDatabasePopulator and DatabasePopulatorUtils classes to insert the desired data right before the test got executed. These are exactly the same classes that are used internally by Spring in order to handle the schema.sql and data.sql files, except now, we are explicitly defining the script files that we want to execute.
So, let's break up what we did step by step, as follows:
Read now
Unlock full access