use of org.springframework.test.web.servlet.MvcResult in project judge by zjnu-acm.
the class ContestControllerTest method testStanding.
/**
* Test of standing method, of class ContestController.
*
* @see ContestController#standing(long)
*/
@Test
public void testStanding() throws Exception {
log.info("standing");
long id = mockDataService.contest().getId();
MvcResult result = mvc.perform(get("/api/contests/{id}/standing.json", id)).andExpect(request().asyncStarted()).andReturn();
MvcResult asyncResult = mvc.perform(asyncDispatch(result)).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 LanguageControllerTest method testFindOne.
/**
* Test of findOne method, of class LanguageController.
*
* @see LanguageController#findOne(long)
*/
@Test
public void testFindOne() throws Exception {
log.info("findOne");
long id = 0;
MvcResult result = mvc.perform(get("/api/languages/{id}.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 LanguageControllerTest method testUpdate.
/**
* Test of update method, of class LanguageController.
*
* @see LanguageController#update(long, Language)
*/
@Test
public void testUpdate() throws Exception {
log.info("update");
long id = 0;
Language request = Language.builder().name("mock language").sourceExtension("tmp").executableExtension("dummy").build();
MvcResult result = mvc.perform(put("/api/languages/{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 LocaleControllerTest method testFindOne.
/**
* Test of findOne method, of class LocaleController.
*
* @see LocaleController#findOne(String, boolean)
*/
@Test
public void testFindOne() throws Exception {
log.info("findOne");
String id = "en";
boolean support = false;
MvcResult result = mvc.perform(get("/api/locales/{id}.json", id).param("support", Boolean.toString(support))).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 MiscControllerTest method testSystemInfo.
/**
* Test of systemInfo method, of class MiscController.
*
* @see MiscController#systemInfo()
*/
@Test
public void testSystemInfo() throws Exception {
log.info("systemInfo");
MvcResult result = mvc.perform(get("/api/misc/systemInfo.json")).andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)).andReturn();
}
Aggregations