0
@RunWith(SpringRunner.class)
@SpringBootTest
public class CustomerRestTest {
private static final String BASE_URL = "http://localhost:8080";
@Autowired
private MockMvc mockMvc;
@Test
public void indexTest() {
MvcResult response = null;
try {
response = this.mockMvc.perform(MockMvcRequestBuilders.get(BASE_URL + "/customers").accept(org.springframework.http.MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isOk()).andReturn();
} catch (Exception e) {
System.out.println(e);
}
int codeStatus = response.getResponse().getStatus();
assertEquals("index test expect status 200", 200, codeStatus);
}
}