Skip to content

@FlywayTest not working on abstract classes? #57

@ghost

Description

So I am having this abstract class to make life easier with unit tests:

@RunWith(SpringRunner.class)
@SpringBootTest(
        webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT,
        properties = "spring.profiles.active=test")
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
@TestExecutionListeners({
        DependencyInjectionTestExecutionListener.class,
        FlywayTestExecutionListener.class
})
@FlywayTest
public abstract class AbstractLiveTest {

    @Value("${security.jwt.client-id}")
    protected String clientId;

    @Value("${security.jwt.client-secret}")
    protected String clientSecret;

    @Value("${security.jwt.client-secret-plain}")
    protected String clientSecretPlain;

    @Value("${server.port}")
    protected Integer serverPort;

    @Autowired
    protected TestRestTemplate template;

}

Notice the @FlywayTest annotation. This does not seem to work. I have to add @FlywayTest to all test classes separately e.g.

@FlywayTest
public class MyTests extends AbstractLiveTest {
}

otherwise it won't work. I do not know if this is expected or even intended but I thought I raise that issue here in case it isn't.


I am using org.flywaydb:flyway-core and org.flywaydb.flyway-test-extensions:flyway-spring-test in a Spring Boot (2.0.1.RELEASE) application.

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
</dependency>
<dependency>
    <groupId>org.flywaydb.flyway-test-extensions</groupId>
    <artifactId>flyway-spring-test</artifactId>
    <version>5.0.0</version>
    <scope>test</scope>
</dependency>
$ mvn dependency:tree
..
[INFO] +- org.flywaydb:flyway-core:jar:5.0.7:compile
[INFO] +- org.flywaydb.flyway-test-extensions:flyway-spring-test:jar:5.0.0:test
..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions