Junit测试配置

 

package cn.test;
import java.util.Calendar;
import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import cn.com.xxsoft.winddata.service.Windservice;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations={"classpath*:applicationContext_db.xml",
        "classpath*:applicationContext_beans.xml",
        "classpath*:applicationContext_ehcache.xml"})
public class WindServiceJunitTest{
    @Autowired
    protected Windservice windservices;
    
    @Test
    public void sendEmailTest(){
//        windservices = SpringContextUtil.getBean("Windservice");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.MONTH,-3);
        calendar.set(Calendar.DAY_OF_MONTH,26);
        calendar.set(Calendar.MINUTE,0);
        calendar.set(Calendar.SECOND,0);
        calendar.set(Calendar.MILLISECOND,0);
        Date date = calendar.getTime();
        windservices.sendEmail(date);
        
    }
}

 

posted @ 2019-11-04 15:32  笔记Next  阅读(446)  评论(0编辑  收藏  举报