Search code examples
javaspringspring-boottestingintegration-testing

Junit test run in Eclipse but fails with `gradle test`


I'm using Spring Boot 2 and I'm trying to do an integration test. I configured a custom application.properties this way:

@TestPropertySource(
    locations = "classpath:###/$$$/application-integrationtest.properties"
)
@ComponentScan(basePackages = { "###.$$$" })

File is under src/test/java/###/$$$/application-integrationtest.properties

Running Junit under Eclipse works fine, but if I try gradle test, I get:

java.io.FileNotFoundException: class path resource [###/$$$/application-integrationtest.properties] cannot be opened because it does not exist

What's the deal?


Solution

  • Following JB Nizet's comment I put my property file under src/test/resources and added the folder to the build path in Eclipse.