Consider the following example:
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = {
"some.property=valueA"
})
public class ServiceTest {
@Test
public void testA() { ... }
@Test
public void testB() { ... }
@Test
public void testC() { ... }
}
I'm using SpringBootTest
annotation's properties
attribute to set some.property
property's value for all tests in this test suite. Now I'd like to set another value of this property for one of this tests (let's say testC
) without affecting the others. How can I achieve this? I've read the "Testing" chapter of Spring Boot docs, but I haven't found anything that'd match my use case.