|
1 | 1 | package org.baeldung.web.service; |
2 | 2 |
|
| 3 | +import static io.restassured.RestAssured.given; |
| 4 | +import static org.hamcrest.core.Is.is; |
| 5 | +import static org.hamcrest.core.IsCollectionContaining.hasItems; |
| 6 | +import static org.hamcrest.core.IsEqual.equalTo; |
| 7 | + |
3 | 8 | import org.apache.commons.lang3.RandomStringUtils; |
4 | 9 | import org.baeldung.web.main.Application; |
5 | 10 | import org.junit.Test; |
6 | 11 | import org.junit.runner.RunWith; |
7 | | -import org.springframework.boot.test.IntegrationTest; |
8 | | -import org.springframework.boot.test.SpringApplicationConfiguration; |
9 | | -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
10 | | -import org.springframework.test.context.web.WebAppConfiguration; |
11 | | - |
12 | | -import static io.restassured.RestAssured.*; |
13 | | -import static org.hamcrest.core.IsCollectionContaining.*; |
14 | | -import static org.hamcrest.core.Is.*; |
15 | | -import static org.hamcrest.core.IsEqual.*; |
| 12 | +import org.springframework.boot.test.context.SpringBootTest; |
| 13 | +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; |
| 14 | +import org.springframework.test.context.junit4.SpringRunner; |
16 | 15 |
|
17 | | -@RunWith(SpringJUnit4ClassRunner.class) |
18 | | -@SpringApplicationConfiguration(classes = Application.class) |
19 | | -@WebAppConfiguration |
20 | | -@IntegrationTest("server.port:8888") |
| 16 | +@RunWith(SpringRunner.class) |
| 17 | +@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) |
21 | 18 | public class StudentServiceIntegrationTest { |
22 | 19 |
|
23 | | - private static final String ENDPOINT = "http://localhost:8888/student/get"; |
| 20 | + private static final String ENDPOINT = "http://localhost:8080/student/get"; |
24 | 21 |
|
25 | 22 | @Test |
26 | 23 | public void givenRequestForStudents_whenPageIsOne_expectContainsNames() { |
|
0 commit comments