Skip to content

Commit

Permalink
adding integration test support with Test container for MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourav Roy authored and Sourav Roy committed Jan 9, 2024
1 parent eaeb2b9 commit f1a15e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/test/java/com/homihq/db2rest/BaseIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
@ActiveProfiles("it")
@ExtendWith({ RestDocumentationExtension.class})
@ExtendWith({RestDocumentationExtension.class})
public abstract class BaseIntegrationTest {

@Autowired
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/com/homihq/db2rest/rest/MySQLReadControllerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.homihq.db2rest.rest;

import com.homihq.db2rest.MySQLBaseIntegrationTest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;

import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

class MySQLReadControllerTest extends MySQLBaseIntegrationTest {
@Test
@DisplayName("Get all fields.")
void findAllFilms() throws Exception {

mockMvc.perform(get("/films")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andDo(document("get-all-films"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class PgReadControllerTest extends PostgreSQLBaseIntegrationTest {
@DisplayName("Get all fields.")
void findAllFilms() throws Exception {


mockMvc.perform(get("/films")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
Expand Down

0 comments on commit f1a15e5

Please sign in to comment.