package com.example.test;
//
//import org.junit.Before;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.test.context.ContextConfiguration;
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
//import org.springframework.test.context.web.WebAppConfiguration;
//import org.springframework.test.web.servlet.MockMvc;
//import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
//import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
//import org.springframework.test.web.servlet.setup.MockMvcBuilders;
//import org.springframework.web.context.WebApplicationContext;
//
//
//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
//
////首先指定Junit的Runner
//@RunWith(SpringJUnit4ClassRunner.class)
//// 指明配置文件所在
//@ContextConfiguration(locations = {"classpath:applicationContext.xml","classpath:spring-mvc.xml"})
//@WebAppConfiguration
public class MockMvcTest {
//
// @Autowired
// private WebApplicationContext webApplicationContext;
//
// private MockMvc mockMvc;
//
// @Before
// public void setUp() throws Exception {
// mockMvc = MockMvcBuilders.webAppContextSetup(this.webApplicationContext).build();
// }
//
//// @Test
//// public void testHelloController1() throws Exception {
//// mockMvc.perform(MockMvcRequestBuilders.get("/hello")
//// .accept(MediaType.APPLICATION_JSON))
//// .andExpect(status().isOk())
//// .andDo(MockMvcResultHandlers.print());
//// }
//
// @Test
// public void testStudentController() throws Exception {
//// mockMvc.perform(MockMvcRequestBuilders.get("/toHello"))
//// .andExpect(status().isOk())
//// .andDo(MockMvcResultHandlers.print());
//
// mockMvc.perform(MockMvcRequestBuilders.get("/list"))
// .andExpect(status().isOk())
// .andDo(MockMvcResultHandlers.print());
//
//// mockMvc.perform(MockMvcRequestBuilders.get("/toAdd"))
//// .andExpect(status().isOk())
//// .andDo(MockMvcResultHandlers.print());
////
//// mockMvc.perform(MockMvcRequestBuilders.post("/add").param("name", "XH")
//// .param("niceName", "XH1995").param("age", "24"))
//// .andExpect(status().isFound())
//// .andDo(MockMvcResultHandlers.print());
////
//// mockMvc.perform(MockMvcRequestBuilders.get("/show").param("id", "147"))
//// .andExpect(status().isOk())
//// .andDo(MockMvcResultHandlers.print());
////
//// mockMvc.perform(MockMvcRequestBuilders.get("/toEdit").param("id", "147"))
//// .andExpect(status().isOk())
//// .andDo(MockMvcResultHandlers.print());
////
//// mockMvc.perform(MockMvcRequestBuilders.post("/edit").param("id", "147")
//// .param("name", "Tom123").param("niceName", "Tom123").param("age", "24"))
//// .andExpect(status().isFound())
//// .andDo(MockMvcResultHandlers.print());
////
//// mockMvc.perform(MockMvcRequestBuilders.get("/delete").param("id", "147"))
//// .andExpect(status().isFound())
//// .andDo(MockMvcResultHandlers.print());
// }
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
spring-boot-hibernate-thymeleaf.rar (43个子文件)
spring-boot-hibernate-thymeleaf
.project 583B
src
test
resources
java
main
resources
application.properties 1KB
templates
edit.html 2KB
detail.html 733B
hello.html 57B
list.html 1KB
add.html 1KB
static
jquery.min.js 91KB
js
user.js 1KB
css
bootstrap.css 143KB
java
com
example
MyApplication.java 312B
service
StudentService.java 430B
impl
StudentServiceImpl.java 864B
model
Student.java 1KB
controller
StudentController.java 2KB
HelloController.java 645B
dao
StudentDao.java 410B
test
MockMvcTest.java 3KB
target
classes
application.properties 1KB
com
example
MyApplication.class 736B
service
impl
StudentServiceImpl.class 2KB
StudentService.class 423B
model
Student.class 2KB
controller
StudentController.class 3KB
HelloController.class 1KB
dao
StudentDao.class 313B
test
MockMvcTest.class 292B
META-INF
MANIFEST.MF 390B
maven
com.xh.sbht
spring-boot-hibernate-thymeleaf
pom.properties 319B
pom.xml 2KB
templates
edit.html 2KB
detail.html 733B
hello.html 57B
list.html 1KB
add.html 1KB
static
jquery.min.js 91KB
js
user.js 1KB
css
bootstrap.css 143KB
test-classes
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.jdt.core.prefs 243B
org.eclipse.core.resources.prefs 250B
pom.xml 2KB
.classpath 1KB
共 43 条
- 1
资源评论
- jyxiongw2018-08-16挺不错的,可以运行结果出来
- chenlinshu12018-12-18还可以吧,简单,适合初学者
PandaCode辉
- 粉丝: 94
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功