import java.util.Date;
import javax.annotation.Resource;
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.AbstractJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.yywx.gamesoperator.core.service.BetInfoService;
import com.yywx.gamesoperator.core.service.OperaInfoService;
import com.yywx.gamesoperator.core.service.RoomDateService;
import com.yywx.gamesoperator.core.task.RoomReportTask;
import com.yywx.gamesoperator.core.vo.YyRoomDataVO;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = “classpath:applicationContext.xml”)
public class TestRoom extends AbstractJUnit4SpringContextTests{
@Autowired
RoomReportTask roomReportTask;
@Test
public void test1(){
try {
roomReportTask.saveRoomReport();
} catch (Exception e) {
e.printStackTrace();
}
}
}
要放到相应的@ContextConfiguration(locations = “classpath:applicationContext.xml”)中,因为他会直接从当前test存在的项目去找相应的application。