use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class AccountControllerTest method testPasswordStatus.
/**
* Test of passwordStatus method, of class AccountController.
*
* @see AccountController#passwordStatus()
*/
@Test
public void testPasswordStatus() throws Exception {
log.info("passwordStatus");
MvcResult result = mvc.perform(get("/api/accounts/password/status.json")).andExpect(status().isOk()).andExpect(jsonPath("$.content").isMap()).andExpect(jsonPath("$.stats").isMap()).andReturn();
}
use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class ContestControllerTest method testSave.
/**
* Test of save method, of class ContestController.
*
* @see ContestController#save(Contest)
*/
@Test
public void testSave() throws Exception {
log.info("save");
Contest contest = mockDataService.contest(false);
MvcResult result = mvc.perform(post("/api/contests.json").content(objectMapper.writeValueAsString(contest)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();
}
use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class ContestControllerTest method testSubmittedProblems.
/**
* Test of submittedProblems method, of class ContestController.
*
* @see ContestController#submittedProblems(long)
*/
@Test
public void testSubmittedProblems() throws Exception {
log.info("submittedProblems");
long id = mockDataService.contest().getId();
MvcResult result = mvc.perform(get("/api/contests/{id}/problems/submitted.json", id)).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();
}
use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class ContestControllerTest method testUpdate.
/**
* Test of update method, of class ContestController.
*
* @see ContestController#update(long, Contest)
*/
@Test
public void testUpdate() throws Exception {
log.info("update");
long id = mockDataService.contest().getId();
Contest request = new Contest();
MvcResult result = mvc.perform(patch("/api/contests/{id}.json", id).content(objectMapper.writeValueAsString(request)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNoContent()).andReturn();
}
use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class ContestControllerTest method testList.
/**
* Test of list method, of class ContestController.
*
* @see ContestController#list(ContestForm)
*/
@Test
public void testList() throws Exception {
log.info("list");
boolean includeDisabled = false;
String[] exclude = null;
String[] include = null;
MvcResult result = mvc.perform(get("/api/contests.json").param("includeDisabled", Boolean.toString(includeDisabled)).param("exclude", Objects.toString(exclude, "")).param("include", Objects.toString(include, ""))).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();
}
Aggregations