26
@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(){}
kidwon
  • 4,448
  • 5
  • 28
  • 45

1 Answers1

13

It is still not possible, but there is an open issue for this feature if you wish to follow it.

Stav Shamir
  • 888
  • 7
  • 20
  • 2
    With JUnit 5 you can use `@Nested` test classes, as mentionned in the following reply to the issue : https://github.com/spring-projects/spring-framework/issues/18951#issuecomment-1153547515. So at least your tests can be contained logically in a single test class. – potame Jul 19 '22 at 12:21