|
18 | 18 |
|
19 | 19 | import org.junit.jupiter.api.BeforeEach; |
20 | 20 | import org.junit.jupiter.api.Test; |
| 21 | +import org.testcontainers.containers.Neo4jContainer; |
| 22 | +import org.testcontainers.junit.jupiter.Container; |
| 23 | +import org.testcontainers.junit.jupiter.Testcontainers; |
| 24 | +import org.testcontainers.utility.DockerImageName; |
21 | 25 |
|
22 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
23 | | -import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration; |
24 | 27 | import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
25 | 28 | import org.springframework.boot.test.context.SpringBootTest; |
26 | | -import org.springframework.context.annotation.Import; |
| 29 | +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; |
27 | 30 | import org.springframework.test.web.servlet.MockMvc; |
28 | 31 | import org.springframework.test.web.servlet.MvcResult; |
29 | 32 |
|
30 | | -import static org.hamcrest.Matchers.*; |
31 | | -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; |
32 | | -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; |
33 | | -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
34 | | - |
| 33 | +import static org.hamcrest.Matchers.containsString; |
| 34 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; |
| 35 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
| 36 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; |
| 37 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; |
| 38 | +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; |
| 39 | +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; |
| 40 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; |
| 41 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; |
| 42 | +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
| 43 | + |
| 44 | +@Testcontainers |
35 | 45 | @SpringBootTest |
36 | 46 | @AutoConfigureMockMvc |
37 | 47 | public class AccessingNeo4jDataRestApplicationTests { |
38 | 48 |
|
| 49 | + @Container |
| 50 | + @ServiceConnection |
| 51 | + static Neo4jContainer<?> neo4jContainer = new Neo4jContainer<>(DockerImageName.parse("neo4j:latest")) |
| 52 | + .withAdminPassword("a_strong_password"); |
| 53 | + |
39 | 54 | @Autowired |
40 | 55 | private MockMvc mockMvc; |
41 | 56 |
|
|
0 commit comments