22
33import static org .junit .Assert .assertEquals ;
44
5+ import org .junit .After ;
6+ import org .junit .Before ;
57import org .junit .Test ;
68import org .springframework .boot .test .web .client .TestRestTemplate ;
9+ import org .springframework .boot .web .client .RestTemplateBuilder ;
710import org .springframework .http .HttpMethod ;
811import org .springframework .http .ResponseEntity ;
912
13+ import java .time .Duration ;
14+
1015public class RestartApplicationIntegrationTest {
11-
12- private TestRestTemplate template = new TestRestTemplate ();
16+
17+ private TestRestTemplate restTemplate = new TestRestTemplate ();
1318
1419 @ Test
1520 public void givenBootApp_whenRestart_thenOk () throws Exception {
1621 Application .main (new String [0 ]);
17-
18- ResponseEntity response = template .exchange ("http://localhost:8080/restart" ,
22+
23+ ResponseEntity response = restTemplate .exchange ("http://localhost:8080/restart" ,
1924 HttpMethod .POST , null , Object .class );
2025
2126 assertEquals (200 , response .getStatusCode ().value ());
@@ -24,11 +29,11 @@ public void givenBootApp_whenRestart_thenOk() throws Exception {
2429 @ Test
2530 public void givenBootApp_whenRestartUsingActuator_thenOk () throws Exception {
2631 Application .main (new String [] { "--server.port=8090" });
27-
28- ResponseEntity response = template .exchange ("http://localhost:8090/restartApp" ,
32+
33+ ResponseEntity response = restTemplate .exchange ("http://localhost:8090/restartApp" ,
2934 HttpMethod .POST , null , Object .class );
3035
3136 assertEquals (200 , response .getStatusCode ().value ());
3237 }
3338
34- }
39+ }
0 commit comments