JUNIT在spring2.0的集成测试

 package com.welldell.sox.junit;

import junit.framework.TestCase;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.welldell.sox.dao.FrameUserDao;
import com.welldell.sox.dao.ibatis.FrameUserDaoiBatis;
import com.welldell.sox.model.FrameUser;
import com.welldell.sox.service.FrameUserManager;
import com.welldell.sox.service.impl.FrameUserManagerImpl;

 

public class LoginDaoTest extends TestCase {
  public FrameUserManager frameUsermgr;

 public void setUp() throws Exception{
        super.setUp();
        frameUsermgr = new FrameUserManagerImpl();
        ApplicationContext ctx = new FileSystemXmlApplicationContext(
                "D:/develop/eclipse/workspace/stms3/web/WEB-INF/applicationContext-*.xml");
        frameUsermgr = (FrameUserManager) ctx.getBean("frameUserManager");
    }

 public void test_login(){
        FrameUser user = new FrameUser();
        user.setUsercode("admin");
        user.setPassword("kyle");
       
        frameUsermgr.login(user) ;
        user = frameUsermgr.getFrameUser(String.valueOf(804211));
       
        assertNull(user);

       // System.out.println(user.getUsername());
    }
 
 protected void tearDown() throws Exception {
  super.tearDown();
 }

}

你可能感兴趣的:(java,junit,spring,exception,user,login,class)