Access to test resources in Spring boot tests
To access to a resources test in spring boot tests, you can use the following statement :
Paths.get(getClass().getResource(resourcePath).toURI());
You can also use the spring annotation TestPropertySource on your test class :
@RunWith(SpringRunner.class)
@TestPropertySource(locations = "resourcePath")
@SpringBootTest
public class InputConfigurationTest {
...
}
Warning : Be careful about the resourcePath variable : this variable must start with a "/". For example : resourcePath = "/config.properties"