ordermanagerimpltest.java

来自「Spring2.0宝典」· Java 代码 · 共 54 行

JAVA
54
字号
package lee;

import junit.framework.TestCase;
import junit.textui.TestRunner;

import org.springframework.test.AbstractDependencyInjectionSpringContextTests;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
 * @author  yeeku.H.lee kongyeeku@163.com
 * @version  1.0
 * <br>Copyright (C), 2005-2008, yeeku.H.Lee
 * <br>This program is protected by copyright laws.
 * <br>Program Name:
 * <br>Date: 
 */
public class OrderManagerImplTest extends AbstractDependencyInjectionSpringContextTests
{
	OrderManager om;

	public String[] getConfigLocations()
	{
		String[] configLocations = {"bean.xml"};
		return configLocations;
	}
	
	public void onSetUp()
	{
		om = (OrderManager)applicationContext.getBean("orderManager");
	}
	public void onTearDown()
	{
		om = null;
    }

    public void testPlaceOrder()
    {
        Customer c = new Customer();
        c.setFirstName("yeeku");
        c.setLastName("lee");
        c.setEmailAddress("spring_test@163.com");
        Order order = new Order();
        order.setOrderNumber("200603034");
        order.setCustomer(c);
        om.placeOrder(order);
    }

    public static void main(String[] args) throws Exception
    {
		TestRunner.run(OrderManagerImplTest.class);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?