junit基础学习之-参数初始化(5)
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)的更多相关文章
- keras模块学习之-参数初始化与对象调用-笔记
本笔记由博客园-圆柱模板 博主整理笔记发布,转载需注明,谢谢合作! 参数初始化(Initializations) 这个模块的作用是在添加layer时调用init进行这一层的权重初始化,有两种初始化方法 ...
- junit基础学习之-测试controller层(2)
准备工作: eclipse本身带有junit4,可以直接build path,加入junit. 连接数据库的配置文件需要修改,之前的文件是采用properties+xml文件的形式,但是在测试的时候因 ...
- Objective-C基础学习笔记——对象初始化
obj中创建新对象有两种方式:[classname new]和[[classname alloc] init].两种方法等价,Cocoa惯例是使用alloc和init. 1.分配对象: allocat ...
- tensorflow 1.0 学习:参数初始化(initializer)
CNN中最重要的就是参数了,包括W,b. 我们训练CNN的最终目的就是得到最好的参数,使得目标函数取得最小值.参数的初始化也同样重要,因此微调受到很多人的重视,那么tf提供了哪些初始化参数的方法呢,我 ...
- tf.variance_scaling_initializer() tensorflow学习:参数初始化
CNN中最重要的就是参数了,包括W,b. 我们训练CNN的最终目的就是得到最好的参数,使得目标函数取得最小值.参数的初始化也同样重要,因此微调受到很多人的重视,那么tf提供了哪些初始化参数的方法呢,我 ...
- junit基础学习之-测试service层(3)
测试步骤: 在之前的文章中已经加了junit的环境,这就不需要了. 1.加载junit类,spring配置文件,指明junit测试器,@Runwith 2.定义变量,service,不可以使用spri ...
- SpringMVC基础学习(三)—参数绑定
一.基本数据类型的绑定 页面 <form action="${pageContext.request.contextPath}/test.do" method="p ...
- junit基础学习
学习地址一:http://blog.csdn.net/andycpp/article/details/1327147/ 学习地址二:http://blog.csdn.net/zen99t/articl ...
- junit基础学习之-junit3和4的区别(4)
junit3和junit4的使用区别如下 1.在JUnit3中需要继承TestCase类,但在JUnit4中已经不需要继承TestCase 2.在JUnit3中需要覆盖TestCase中的setUp和 ...
随机推荐
- 【剑指Offer面试编程题】题目1390:矩形覆盖--九度OJ
题目描述: 我们可以用2*1的小矩形横着或者竖着去覆盖更大的矩形.请问用n个2*1的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法? 输入: 输入可能包含多个测试样例,对于每个测试案例, 输入 ...
- C语言入门书籍知识点记录
1. 数据在内存中的存储(二进制存储) 内存条:电路的电压有两种状态:0V或者5V,对应的一个元器件有2种状态:0 或者1. 一般情况下我们不一个一个的使用元器件,而是将8个元器件看做一个单位. 一个 ...
- android中按back键返回上一个activity,如何重新调用上一个activity的oncreate方法?
默认情况下是不会调用的. @Override public void onBackPressed() { String titleStr = edittitle.getText().toString( ...
- django 配置404,500页面
JSP CURL session COOKIE diango 自定义404 500页面 1.首先将settings设置debug=false; 2.设置static路径 ...
- Android中ListView结合CheckBox判断选中项
本文主要实现在自定义的ListView布局中加入CheckBox控件,通过判断用户是否选中CheckBox来对ListView的选中项进行相应的操作.通过一个Demo来展示该功能,选中ListView ...
- 网站Webshell大马密码极速暴力爆破工具-cheetah
Cheetah是一个基于字典的暴力密码webshell工具,运行速度与猎豹猎物一样快. Cheetah的工作原理是能根据自动探测出的web服务设置相关参数一次性提交大量的探测密码进行爆破,爆破效率 ...
- dataset的reparation和coalesce
/** * Returns a new Dataset that has exactly `numPartitions` partitions, when the fewer partitions * ...
- leetcode236 Lowest Common Ancestor of a Binary Tree
""" Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in ...
- QAM格雷码映射的规则(Gray Code Mapping in QAM)
高阶调制(QAM,MQAM)信号中做基带映射,格雷码作为一种规范的映射规则,加上I,Q方向上相邻两个星座点对应的Bit_Cluster中只有一个Bit不同,所以有方便统一的特性. 以16QAM为例,先 ...
- 命令打开java控制面板
运行一些java程序时,会提示java安全阻止,需要手动运行,java7一起更改安全级别为“中”就可以了,java8需要配置信任网站 . 这些操作都需要在java控制面板进行,经常会出现无法在控制面板 ...