首页>代码>java企业考勤系统>/clocksimplejee4/mock/com/dovesoftware/clocksimplejee3/mockdaoimpl/UserMockDaoImpl.java
package com.dovesoftware.clocksimplejee3.mockdaoimpl;
import java.io.IOException;
import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.Before;
import org.junit.Test;
import com.dovesoftware.clocksimplejee3.dao.UserDao;
import com.dovesoftware.clocksimplejee3.domain.User;
public class UserMockDaoImpl implements UserDao {
private Mockery context = new JUnit4Mockery();
private UserDao clockDao;
/**
* Test method for
* {@link org.hook.jmock.firstcase.HelloServiceImpl#sayHelloToSomebody(java.lang.String)}.
*/
@Override
public User getUserByUsername(User user0) throws IOException {
// set up
clockDao = context.mock(UserDao.class);
final User user = new User();
user.setUsername("jerry");
// expectations
context.checking(new Expectations() {
{
oneOf(clockDao).getUserByUsername(user);
will(returnValue(user));
}
});
// execute
String username = clockDao.getUserByUsername(user).getUsername();
// verify
context.assertIsSatisfied();
Assert.assertEquals("jerry", username);
System.out.println(username);
return user;
}
@Override
public void addLoginFailure(User user) throws Exception {
// TODO Auto-generated method stub
}
@Override
public void addLoginFailureViaUsername(User user) throws Exception {
// TODO Auto-generated method stub
}
@Override
public boolean adminAddUser(User user, String errorMessage)
throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean adminChangeUserPassword(User user,
String confirmnewpassword, String errorMessage) throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean adminDeleteUser(long id) throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean changePassword(User user, String password,String newpassword,
String confirmnewpassword, String errorMessage) throws Exception {
// TODO Auto-generated method stub
return false;
}
@Override
public void clearLoginFailure(User user) throws Exception {
// TODO Auto-generated method stub
}
@Override
public boolean editUser(User user, String errorMessage) throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public String getPinViaId(long userid) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPinbyUserID(long id) throws IOException {
// TODO Auto-generated method stub
return null;
}
@Override
public User getUser(long id) throws IOException {
// TODO Auto-generated method stub
return null;
}
@Override
public List<User> getUserInfo(long id) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean login(User user, String errorMessage) throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean loginViaUserNamePassword(User user, String errorMessage)
throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean registerUser(User user, String errorMessage)
throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean toggleActive(User user, String errorMessage)
throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean toggleAdmin(User user, String errorMessage)
throws IOException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean uniquepin(String pin) throws Exception {
// TODO Auto-generated method stub
return false;
}
@Override
public List<User> getTestUserInfo(long id) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public User getUserByEmpid(User user) throws IOException {
// TODO Auto-generated method stub
return null;
}
@Override
public User getUserByUsernameIncludeUnactive(User user) throws IOException {
// TODO Auto-generated method stub
return null;
}
}
最近下载更多
891087053 LV1
5月17日
balabalawuyu LV6
2022年11月17日
hu10086 LV1
2022年5月21日
xaiozhu LV7
2022年4月10日
liugtnb LV2
2022年3月24日
1819615780 LV1
2021年12月25日
kk1031 LV8
2021年9月6日
LYS_myheart LV2
2021年7月24日
monkalon LV14
2021年7月10日
weijiajun LV1
2021年6月29日
最近浏览更多
wz LV3
9月19日
891087053 LV1
5月17日
微信网友_7513981386297344
5月17日
暂无贡献等级
微信网友_7467320429481984
4月14日
暂无贡献等级
叉烧君 LV3
3月26日
嘲讽脸 LV5
1月15日
xianyu091012 LV5
2024年12月26日
xiquyiyuan LV10
2024年12月3日
gxh666857 LV1
2024年11月27日
黄志琴 LV1
2024年9月29日

