私は春の起動とそのすべての作業を理解しようとしています。現時点では統合テストに苦労しているので、私はspring-boot-samplesを見に行きました。私は見始めたspring-boot-sample-testng春の起動アプリケーションでのテストのしくみ
この統合テストサンプルでは、メインメソッドがあるSampleTestNGApplicationクラスへの参照はありません。
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class SampleTestNGApplicationTests extends AbstractTestNGSpringContextTests {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void testHome() {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
}
MainメソッドがSampleTestNGApplicationクラスにあることをどのように知っていますか?
これはhttps://blog.ccbill.com/spring-boot-and-context-handlingに役立ちます – pvpkiran