package swust.edu.cn.postdoctors.service.impl;

 import java.util.Arrays;
import java.util.Collection; import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.test.context.ContextConfiguration; import swust.edu.cn.postdoctors.model.User;
import swust.edu.cn.postdoctors.service.UserService;
import junit.framework.TestCase; @RunWith(Parameterized.class)
@ContextConfiguration(locations={"classpath:spring-mybatis-test.xml"}) // 加载配置
public class UserServiceTest extends TestCase { private UserService userService; public UserService getUserService() {
return userService;
} public void setUserService(UserService userService) {
this.userService = userService;
} @Parameters
public static Collection<Object[]> data(){
return Arrays.asList(new Object[][]{{"aa",""},{"bb",""},{"cc",""}});
}
private String userLoginname;
private String userPswd; public UserServiceTest(String userLoginname,String userPswd){
this.setUserLoginname(userLoginname);
this.setUserPswd(userPswd);
} public String getUserLoginname() {
return userLoginname;
} public void setUserLoginname(String userLoginname) {
this.userLoginname = userLoginname;
} public String getUserPswd() {
return userPswd;
} public void setUserPswd(String userPswd) {
this.userPswd = userPswd;
} @Before
public void before() throws Exception {
userService = new UserServiceImpl();
} @Test
public void testSelectUserByLoginNameAndPswd() throws Exception {
if(userService == null){
System.out.println("========================userService 出错!");
}
User exUser = new User();
exUser.setUserLoginname(userLoginname);
exUser.setUserPassword(userPswd); User outUser = null; outUser = userService.findUserByLoginNameAndPswd(userLoginname, userPswd); assertEquals(exUser,outUser); } }

最新文章

  1. SQL语句全
  2. 可提高工作效率的 PL/SQL Developer 设置
  3. Windows 磁盘检查命令
  4. JavaScript包装对象
  5. webservice入门(2)开发ws程序
  6. 加州大学伯克利分校Stat2.3x Inference 统计推断学习笔记: Section 3 One-sample and two-sample tests
  7. struts.xml配置
  8. VBA的打开关闭保存另存为等事件无法正常跑的原因
  9. 545E. Paths and Trees
  10. javascript获取对应页面的代码
  11. Bootstrap 简洁、直观、强悍、移动设备优先的前端开发框架,让web开发更迅速、简单。
  12. C#递归复制文件夹
  13. FCKeditor 2.6.6在ASP中的安装及配置方法分享--ZZ转载自网络
  14. POJ1050(dp)
  15. Angular+ionic2 web端 启动程序出现短暂 白屏或黑屏 的处理小妙招
  16. Java开发笔记(八十五)通过字符流读写文件
  17. lintcode中等题目的四道题
  18. day02 while循环 运算符 格式化输出 编码
  19. Luogu2839 Middle 主席树、二分答案
  20. mvc 缓存页面 减轻服务器压力

热门文章

  1. 【JS 常用操作】
  2. Django:验证码相关问题
  3. windows环境变量引发的血案
  4. JavaWeb开发:从购买服务器到简单demo运行
  5. 三 PrePareStatement注入,DELETE和TRUNCATE
  6. Python面试2未完待续
  7. Ayoub&#39;s function
  8. GoJS、AngularJS自定义组件JS SDK注解参考
  9. 022、Java中boolean的用法
  10. 010.CI4框架CodeIgniter, autoload自动加载自己的helper函数类