[img=http://][/img]package org.ultimania.service;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.ultimania.dao.UserDAO;
import org.ultimania.dao.UserDAOImpal;
import org.ultimania.model.User;
public class UserServiceImplTest {
public UserServiceImpl userService ;
@Before
public void setUp() throws Exception {
userService = new UserServiceImpl();
UserDAO userDAO = new UserDAOImpal();
userService.setUserDAO(userDAO);
}
@Test
public void testLogin() {
assertEquals(true,userService.login("admin", "admin"));
//fail("Not yet implemented");
}
@Test
public void testIsExist() {
//fail("Not yet implemented");
assertEquals(true,userService.isExist("admin"));
}
@Test
public void testRegister() {
//fail("Not yet implemented");
User record = new User();
record.setEmail("test@123.com");
record.setId(1110);
record.setPassword("test");
record.setUsername("test");
userService.register(record);
assertEquals(1110,userService.isExist("test"));
}
}
http://blog.csdn.net/wyxz126/article/details/8531817我发现问题了:
@Test
public void abc(){}
如果括号内有参数,有一定可能会报这种错误