ideaユニットテスト@autowired beanはnull

3383 ワード

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:spring.xml")
public class CBannerServiceImplTest {

    @Autowired
    private ICBannerService bannerService;

@Before
public void before() throws Exception { 
} 

@After
public void after() throws Exception { 
} 

/** 
* 
* Method: getIndexBannerList(CBannerVO cBannerVO) 
* 
*/ 
@Test
public void testGetIndexBannerList() throws Exception { 
//TODO: Test goes here...
    CBannerVO cBannerVO = new CBannerVO();
    cBannerVO.setPageSize(2);
    cBannerVO.setClient("10");
    cBannerVO.setUserType("10");
    ResultResponse<List<CBanner>> indexBannerList = bannerService.getIndexBannerList(cBannerVO);
    System.out.println(indexBannerList);
}