@TestPropertySource(locations="classpath:test.properties")
public class Aclass {}
Is there an alternative that uses properties for the tested instance in a method.
@Test
public void aMethod(){}
@TestPropertySource is a class-level annotation that is used to configure the locations() of properties files and inlined properties() to be added to the Environment 's set of PropertySources for an ApplicationContext for integration tests.
You can use @TestPropertySource annotation in your test class. Just annotate @TestPropertySource("classpath:config/mailing. properties") on your test class. You should be able to read out the property for example with the @Value annotation.
properties file in the classpath (src/main/resources/application. properties).
It is still not possible, but there is an open issue for this feature if you wish to follow it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With