import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.job36.admanage.service.AdAdTypeService;
import com.job36.admanage.vo.AdAdTypeVO;
public class AdTypeTest {
ApplicationContext dsContext = null;
AdAdTypeService adAdTypeService = null;
AdAdTypeVO adAdTypeVO = null;
@Before
public void init() throws Exception {
dsContext = new ClassPathXmlApplicationContext(new String[] {
"applicationContext.xml", "applicationContext-dao.xml",
"applicationContext-service.xml" });
adAdTypeVO = new AdAdTypeVO();
adAdTypeVO.setTypeId(1);
adAdTypeVO.setTypeName("banner");
adAdTypeVO.setMessage("测试");
adAdTypeService = (AdAdTypeService) dsContext.getBean("AdAdTypeService");
}
@Test
public void findByCondition() {
assertEquals(adAdTypeService.findByCondition(adAdTypeVO).getListAdAdTypeVO().get(0), adAdTypeVO);
}
}
junit4 单元测试service(Spring)方法
最新推荐文章于 2023-01-07 09:18:44 发布