master
erzhongxmu 2023-02-12 19:05:53 +08:00
parent 7c4b38b6db
commit ca033c0966
2 changed files with 3 additions and 18 deletions

View File

@ -6,10 +6,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
/**
*
* @author
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = {"classpath*:spring*.xml"})

View File

@ -1,16 +1,11 @@
package org.jeecgframework.test.demo;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
import com.zzjee.wmutil.uasUtil;
import com.zzjee.wmutil.yyUtil;
import org.jeecgframework.AbstractUnitTest;
import org.jeecgframework.core.util.DateUtils;
import org.junit.Before;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
@ -18,15 +13,9 @@ import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import java.util.HashMap;
import java.util.Map;
/**
* Controller Demo
* @author
*/
public class ControllerTestDemo extends AbstractUnitTest{
private MockMvc mockMvc;
private MockHttpSession session; //为模拟登录时所有请求使用同一个session
@Before
@ -76,7 +65,7 @@ public class ControllerTestDemo extends AbstractUnitTest{
// .andDo(print()) //打印报文
// .andExpect(view().name(containsString("jeecg/demo/base/tabledemo"))); //验证返回view 是否不正确
}
//使用jsonPath 验证返回json 的属性
@Test
public void testPDemoList() throws Exception{