2

I have the following integration test which is setting up the database with @DatabaseSetup and checking that after doStuffThatAffectsTheDb() executes, the db has been modified as expected with @ExpectedDatabase:

@Test
@DatabaseSetup(value = "/dataset1.xml", type = CLEAN_INSERT)
@ExpectedDatabase(value = "/dataset1-expected.xml", assertionMode = NON_STRICT_UNORDERED)
@DatabaseTearDown(value = "/clean_data.xml", type = DELETE_ALL)
void test_stuff() throws Exception {
    doStuffThatAffectsTheDb()
}

Now I have other cases that I want to check, with new pairs or datasetX.xml / datasetX-expected.xml.

At first I duplicated the test and changed the values of @DatabaseSetup and @ExpectedDatabase, but it duplicates code, and sonar complains and advises to use @ParameterizedTest.

But I can't find any way to combine @ParameterizedTest and @DatabaseSetup. Is it possible?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.