master
parent
7c4b38b6db
commit
ca033c0966
|
@ -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"})
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue