1
|
package cz.zcu.kiv.aswi.fulltextsearch;
|
2
|
|
3
|
import org.junit.jupiter.api.Test;
|
4
|
import org.springframework.beans.factory.annotation.Autowired;
|
5
|
import org.springframework.boot.test.context.SpringBootTest;
|
6
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
7
|
import org.springframework.boot.web.server.LocalServerPort;
|
8
|
|
9
|
import static org.assertj.core.api.Assertions.assertThat;
|
10
|
|
11
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
12
|
public class HttpRequestTest {
|
13
|
|
14
|
@LocalServerPort
|
15
|
private int port;
|
16
|
|
17
|
@Autowired
|
18
|
private TestRestTemplate restTemplate;
|
19
|
|
20
|
@Autowired
|
21
|
private IndexController controller;
|
22
|
|
23
|
@Test
|
24
|
public void infoTest() throws Exception {
|
25
|
assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/info",
|
26
|
String.class)).contains(controller.info());
|
27
|
}
|
28
|
|
29
|
}
|