Closed Rafal-Laskowski closed 4 years ago
Okay, I actually found the solution.
Working example:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles(profiles = "db")
@TestExecutionListeners({FlywayTestExecutionListener.class, DependencyInjectionTestExecutionListener.class})
public class IntegrationTest {
@BeforeEach
@FlywayTest
void flywayClean() {
}
Use FlywayTestExecutionListener
so it can invoke the annotation on @BeforeEach
method and add DependencyInjectionTestExecutionLicenser.class
if you use any Spring values like @LocalServerPort
Hello,
I try to implement FlywayTest extension with Spring 5 and JUnit 5.
What I was able to achieve:
If I annotate the method with
@FlywayTest
the database is clear.However, if I do it on
beforeEach
level, DB is not cleared:The above code is full example. I do not use any other methods or annotations. Do I do something wrong? Am I missing something?
Thank you in advance