增加文件前缀和后缀的设置,修缮部分代码规范
This commit is contained in:
@@ -6,7 +6,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/*
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@Slf4j
|
||||
@@ -22,4 +22,4 @@ public class LoggerTest {
|
||||
log.error("error...");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/*
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@@ -21,42 +21,42 @@ public class DataControllerTest {
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
|
||||
*/
|
||||
/**
|
||||
|
||||
/**
|
||||
* 使用此单元测试前要注销拦截器,否则测试不通过
|
||||
* @throws Exception
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void adduserque() throws Exception{
|
||||
public void adduserque() throws Exception {
|
||||
mvc.perform(MockMvcRequestBuilders.post("/home/adduserque")
|
||||
.param("coluserid","53")
|
||||
.param("question","您母亲的姓名是?")
|
||||
.param("answer","YHM"))
|
||||
.param("coluserid", "53")
|
||||
.param("question", "您母亲的姓名是?")
|
||||
.param("answer", "YHM"))
|
||||
.andExpect(MockMvcResultMatchers.content().string("true"));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
*测试找回密码
|
||||
|
||||
/**
|
||||
* 测试找回密码
|
||||
* @throws Exception
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void findUserQue() throws Exception{
|
||||
public void findUserQue() throws Exception {
|
||||
//测试问题和答案均正确
|
||||
mvc.perform(MockMvcRequestBuilders.get("/finduserque")
|
||||
.param("name","root")
|
||||
.param("question","您配偶的姓名是?")
|
||||
.param("answer","abc"))
|
||||
.param("name", "root")
|
||||
.param("question", "您配偶的姓名是?")
|
||||
.param("answer", "abc"))
|
||||
.andExpect(MockMvcResultMatchers.content().string("true"));
|
||||
|
||||
//测试问题错误
|
||||
mvc.perform(MockMvcRequestBuilders.get("/finduserque")
|
||||
.param("name","root")
|
||||
.param("question","您配偶的姓名是")
|
||||
.param("answer","abc"))
|
||||
.param("name", "root")
|
||||
.param("question", "您配偶的姓名是")
|
||||
.param("answer", "abc"))
|
||||
.andExpect(MockMvcResultMatchers.content().json("{\n" +
|
||||
" \"code\": 611,\n" +
|
||||
" \"message\": \"问题与答案不匹配\",\n" +
|
||||
@@ -65,16 +65,16 @@ public class DataControllerTest {
|
||||
|
||||
//测试问题正确,答案错误
|
||||
mvc.perform(MockMvcRequestBuilders.get("/finduserque")
|
||||
.param("name","root")
|
||||
.param("question","您配偶的姓名是?")
|
||||
.param("answer","a"))
|
||||
.param("name", "root")
|
||||
.param("question", "您配偶的姓名是?")
|
||||
.param("answer", "a"))
|
||||
.andExpect(MockMvcResultMatchers.content().string("false"));
|
||||
|
||||
//未设置问题
|
||||
mvc.perform(MockMvcRequestBuilders.get("/finduserque")
|
||||
.param("name","roo")
|
||||
.param("question","您配偶的姓名是?")
|
||||
.param("answer","a"))
|
||||
.param("name", "roo")
|
||||
.param("question", "您配偶的姓名是?")
|
||||
.param("answer", "a"))
|
||||
.andExpect(MockMvcResultMatchers.content().json("{\n" +
|
||||
" \"code\": 610,\n" +
|
||||
" \"message\": \"该用户未设置密保问题\",\n" +
|
||||
@@ -82,20 +82,20 @@ public class DataControllerTest {
|
||||
"}"));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 测试忘记密码操作
|
||||
|
||||
|
||||
/* * 测试忘记密码操作
|
||||
* @throws Exception
|
||||
*//*
|
||||
*/
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void resetPass() throws Exception{
|
||||
public void resetPass() throws Exception {
|
||||
mvc.perform(MockMvcRequestBuilders.post("/resetPass")
|
||||
.param("name","root")
|
||||
.param("question","您配偶的姓名是?")
|
||||
.param("answer","abc")
|
||||
.param("password","admin"))
|
||||
.param("name", "root")
|
||||
.param("question", "您配偶的姓名是?")
|
||||
.param("answer", "abc")
|
||||
.param("password", "admin"))
|
||||
.andExpect(MockMvcResultMatchers.content().string("true"));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/*
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@@ -40,4 +40,4 @@ public class LoginControllerTest {
|
||||
" \"data\": null\n" +
|
||||
"}"));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/*
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@@ -74,4 +74,4 @@ public class RegisterControllerTest {
|
||||
.param("name","root1"))
|
||||
.andExpect(MockMvcResultMatchers.content().string("true"));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
/*
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@@ -39,4 +39,4 @@ public class TestControllerTest {
|
||||
mvc.perform(MockMvcRequestBuilders.get("/test/id/1"))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user