chore: simplify and use docker for production testing
This commit is contained in:
parent
6d14e5c2aa
commit
11160b879f
3 changed files with 53 additions and 24 deletions
|
|
@ -21,6 +21,9 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
|||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@WebMvcTest(ApiController.class)
|
||||
|
|
@ -44,8 +47,8 @@ public class ApiControllerTest {
|
|||
String endpoint = "/api/v1/uid";
|
||||
String expected = "s2522255";
|
||||
var mock = mockMvc.perform(get(endpoint));
|
||||
mock.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
mock.andExpect(MockMvcResultMatchers.content().string(expected));
|
||||
mock.andExpect(status().isOk());
|
||||
mock.andExpect(content().string(expected));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,8 +70,8 @@ public class ApiControllerTest {
|
|||
.content(objectMapper.writeValueAsString(req)));
|
||||
|
||||
|
||||
mock.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
mock.andExpect(MockMvcResultMatchers.content().string(String.valueOf(expected)));
|
||||
mock.andExpect(status().isOk());
|
||||
mock.andExpect(content().string(String.valueOf(expected)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -88,7 +91,7 @@ public class ApiControllerTest {
|
|||
var mock = mockMvc.perform(post(endpoint)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(req))
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest());
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -112,8 +115,8 @@ public class ApiControllerTest {
|
|||
.content(objectMapper.writeValueAsString(req)));
|
||||
|
||||
|
||||
mock.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
mock.andExpect(MockMvcResultMatchers.content().string(String.valueOf(expected)));
|
||||
mock.andExpect(status().isOk());
|
||||
mock.andExpect(content().string(String.valueOf(expected)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -127,7 +130,7 @@ public class ApiControllerTest {
|
|||
mockMvc.perform(post("/api/v1/isCloseTo")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(malformedJson))
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest());
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -150,9 +153,8 @@ public class ApiControllerTest {
|
|||
.content(objectMapper.writeValueAsString(req)));
|
||||
|
||||
|
||||
mock.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
mock.andExpect(MockMvcResultMatchers.content().json(
|
||||
objectMapper.writeValueAsString(expected)));
|
||||
mock.andExpect(status().isOk());
|
||||
mock.andExpect(content().json(objectMapper.writeValueAsString(expected)));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -196,8 +198,8 @@ public class ApiControllerTest {
|
|||
.content(objectMapper.writeValueAsString(req)));
|
||||
|
||||
|
||||
mock.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
mock.andExpect(MockMvcResultMatchers.content().string(String.valueOf(expected)));
|
||||
mock.andExpect(status().isOk());
|
||||
mock.andExpect(content().string(String.valueOf(expected)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -211,7 +213,7 @@ public class ApiControllerTest {
|
|||
mockMvc.perform(post("/api/v1/isInRegion")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(objectMapper.writeValueAsString(request)))
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest());
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -231,7 +233,7 @@ public class ApiControllerTest {
|
|||
mockMvc.perform(post("/api/v1/isInRegion")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(objectMapper.writeValueAsString(request)))
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest());
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue