-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHealthCheckControllerTest.java
More file actions
32 lines (27 loc) · 1.26 KB
/
HealthCheckControllerTest.java
File metadata and controls
32 lines (27 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.gam.api.controller;
import com.gam.api.config.WebMvcConfig;
import com.gam.api.config.json.CustomObjectMapper;
import com.gam.api.domain.test.controller.TestController;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@AutoConfigureMockMvc
@WebMvcTest(controllers = TestController.class)
public class HealthCheckControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void healthCheckReturn() throws Exception {
String WELCOME_STRING = "Hello gam Server!";
mvc.perform(get("/health"))
.andExpect(status().isOk())
.andExpect(content().string(WELCOME_STRING));
}
}