package test.user;
import java.net.URL;
import org.apache.log4j.PropertyConfigurator;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.skyline.user.model.User;
import com.skyline.user.service.BasicUserService;
public class TestUser {
static BasicUserService userservice = null;
static {
URL url = BasicUserService.class.getClassLoader().getResource("config/logger/log4j.properties");
PropertyConfigurator.configure(url);
}
@BeforeClass
public static void before() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(
"config/context/applicationContext.xml");
userservice = (BasicUserService) ctx.getBean("basicUserService");
}
public void regist(){
userservice.regist("buringcl@163.com", "password","fdf");
}
// /@Test
public void login(){
try{
User user=
userservice.login("buringcl@163.com", "password","fff");
if(user!=null) {System.out.println("yes");
System.out.println(user.getNickname());}
}
catch(Exception e){
e.printStackTrace();
}
}
@Test
public void exist(){
System.out.println(
userservice.isUserExist("buringcl@163.com"));
}
}