I dont understand why my executing test nicely working without @RunWith(SpringRunner.class).I have only @SpringBootTest above the test class . Please explain next cases :
1)When I should necessarily set @RunWith(SpringRunner.class)and @SpringBootTest together ?
2)When I can just set only @RunWith(SpringRunner.class) and @SpringBootTest usage is redundant ?
3)When I can just set only @SpringBootTest and @RunWith(SpringRunner.class) usage is redundant ?
My code with nicely executing test is :
@SpringBootTest
//@RunWith(SpringRunner.class)
class SpringBootSimpleTestExampleApplicationTests {
@Autowired
private ApplicationContext applicationContext;
@Test
void contextLoads() {
Object restTempalte = applicationContext.getBeanDefinitionCount();
Assertions.assertThat(applicationContext).isNotNull();
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…