I am attempting to use H2 for my integration tests. I want the H2 database to reset to my data.sql between each test. But in suggested solutions, I have not found to be worked; @Transactional
and @DirtiesContext
does not seems to be working.
In a @beforeAll
, I am setting up a mock queue (using the ElasticMQ
library and wondering if this might also causing an issue?).
The Tests work fine when I run them on their own.
Any Thoughts would be greatly appreciated!
For some reason
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
solved my problem! I had not tried this earlier as@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
did not work for me.