junit 測試
阿新 • • 發佈:2017-05-16
get getbean over sina bsp except cati int sin
public class ATest extends TestCase{ ApplicationContext ctx = null; @Override protected void setUp() throws Exception { System.out.println("%%%%%%%%%%%%%"); ctx = new ClassPathXmlApplicationContext("classpath:res/spring/dao/applicationContext-resources.xml"); // ctx = new FileSystemXmlApplicationContext("D:\\workspace\\AmiBasicModule\\src\\test\\res\\spring\\dao\\applicationContext-resources.xml"); } public void testiBatis(){ OrderManagerInf service = (OrderManagerInf)ctx.getBean("orderManager"); System.out.println(service.dangkouQuery(null)); } }
http://blog.sina.com.cn/s/blog_52fea7b60100op1o.html
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:applicationContext.xml") public class CityImplTest { public void setUp() throws Exception { } public void tearDown() throws Exception { } @Test public void testFindOne() throws Exception { CityImpl cityQuery = new CityImpl(); List<City> cityList = cityQuery.findAll("4ee057d90cf2d13fa03ab5d0"); System.out.println(cityList.get(0).getName()); } public void testFindAll() throws Exception { } public void testSave() throws Exception { } public void testUpdate() throws Exception { } public void testDelete() throws Exception { } public void testSearch() throws Exception { } }
junit 測試