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); } }

junit基础学习之-参数初始化(5)的更多相关文章

  1. keras模块学习之-参数初始化与对象调用-笔记

    本笔记由博客园-圆柱模板 博主整理笔记发布,转载需注明,谢谢合作! 参数初始化(Initializations) 这个模块的作用是在添加layer时调用init进行这一层的权重初始化,有两种初始化方法 ...

  2. junit基础学习之-测试controller层(2)

    准备工作: eclipse本身带有junit4,可以直接build path,加入junit. 连接数据库的配置文件需要修改,之前的文件是采用properties+xml文件的形式,但是在测试的时候因 ...

  3. Objective-C基础学习笔记——对象初始化

    obj中创建新对象有两种方式:[classname new]和[[classname alloc] init].两种方法等价,Cocoa惯例是使用alloc和init. 1.分配对象: allocat ...

  4. tensorflow 1.0 学习:参数初始化(initializer)

    CNN中最重要的就是参数了,包括W,b. 我们训练CNN的最终目的就是得到最好的参数,使得目标函数取得最小值.参数的初始化也同样重要,因此微调受到很多人的重视,那么tf提供了哪些初始化参数的方法呢,我 ...

  5. tf.variance_scaling_initializer() tensorflow学习:参数初始化

    CNN中最重要的就是参数了,包括W,b. 我们训练CNN的最终目的就是得到最好的参数,使得目标函数取得最小值.参数的初始化也同样重要,因此微调受到很多人的重视,那么tf提供了哪些初始化参数的方法呢,我 ...

  6. junit基础学习之-测试service层(3)

    测试步骤: 在之前的文章中已经加了junit的环境,这就不需要了. 1.加载junit类,spring配置文件,指明junit测试器,@Runwith 2.定义变量,service,不可以使用spri ...

  7. SpringMVC基础学习(三)—参数绑定

    一.基本数据类型的绑定 页面 <form action="${pageContext.request.contextPath}/test.do" method="p ...

  8. junit基础学习

    学习地址一:http://blog.csdn.net/andycpp/article/details/1327147/ 学习地址二:http://blog.csdn.net/zen99t/articl ...

  9. junit基础学习之-junit3和4的区别(4)

    junit3和junit4的使用区别如下 1.在JUnit3中需要继承TestCase类,但在JUnit4中已经不需要继承TestCase 2.在JUnit3中需要覆盖TestCase中的setUp和 ...

随机推荐

  1. Python作业篇 day03

    ###一.有变量name = 'aleX leNb',完成如下的操作 name = 'aleX leNb' name1 = ' aleX leNb ' #1.移除name1 变量对应的值两边的空格 , ...

  2. Liunx 如何查看80端口被哪个程序所占用

    场景:启服务时一直报80端口被占用 解决方: 1.首先查看下 80 端口的使用情况 netstat -anp|grep 80 查看80端口被被占用的PID 2.根据这个PID 来查看被哪个程序在使用 ...

  3. jQuery Validation Engine

    <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> ...

  4. [ERROR] error: error while loading <root>, error in opening zip file error: scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.

    在家编译一个Apache的开源项目,在编译时遇到错误如下: error: error while loading <root>, error in opening zip file [ER ...

  5. 解题报告:luogu P1115(模板 最大子段和)

    题目链接:P1115 最大子段和 告诉你,这个我调了一天的题是橙题...... 线性容易得到,放篇题解: #include<bits/stdc++.h> using namespace s ...

  6. jumperserver安装

    参照官网地址进行安装 https://jumpserver.readthedocs.io/zh/master/setup_by_centos.html 在安装的时候踩了一个坑 Python 模块安装中 ...

  7. IOS UIPanGestureRecognizer手势使用及识别状态UIGestureRecognizerState

    UIGestureRecognizerState -- 手势识别器状态 1.先来看官方文档 定义UIGestureRecognizer.h 英文: typedef NS_ENUM(NSInteger, ...

  8. BugFix系列---开篇介绍

      这个系列的文章,主要目的在于积累总结实际开发中遇到的错误,记录下来自己的解决思路,用来提升自己. 不出意外,应该会持续不断的记录更新,在整个开发openstack的过程中,抓住机会吸取开源界大牛的 ...

  9. 公用表表达式(CTE) with as 片段

    1.为什么用CTE,而不用表变量, declare @t table(CountryRegionCode nvarchar(3)) insert into @t(CountryRegionCode)  ...

  10. C# webkit 内核浏览器 访问https 网站 提示 Problem with the SSL CA cert (path? access rights?)

    C# webkit 内核浏览器 访问https 网站 提示 Problem with the SSL CA cert (path? access rights?) 解决方法: 陈凯文11112014- ...