单题选项排序;
parent
09929b9223
commit
e86a99d945
@ -0,0 +1,37 @@
|
||||
package com.ibeetl.jlw.web;
|
||||
|
||||
import base.BaseTest;
|
||||
import com.ibeetl.admin.core.util.BeanUtil;
|
||||
import com.ibeetl.jlw.web.query.ResourcesQuestionQuery;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.RequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
class ResourcesQuestionControllerTest extends BaseTest {
|
||||
|
||||
private static final String MODEL = "/jlw/resourcesQuestion";
|
||||
private static final String API = "/api/resourcesQuestion";
|
||||
|
||||
@Test
|
||||
void list() throws Exception {
|
||||
MultiValueMap<String, String> multiValueMap = BeanUtil.beanToStrMultiMap(new ResourcesQuestionQuery());
|
||||
|
||||
//构造请求参数
|
||||
RequestBuilder rb = MockMvcRequestBuilders.post(MODEL + "/list.json")
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
.params(multiValueMap);
|
||||
|
||||
//发送请求,验证返回结果
|
||||
String result = mvc.perform(rb)
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("0"))
|
||||
.andReturn().getResponse().getContentAsString();
|
||||
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue