KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > store > orders > OrderExportTest


1 /*
2  * Created on Mar 8, 2005
3  */

4 package com.openedit.store.orders;
5
6 import com.openedit.WebPageRequest;
7 import com.openedit.modules.cart.CartModule;
8 import com.openedit.store.Cart;
9 import com.openedit.store.CartItem;
10 import com.openedit.store.Order;
11 import com.openedit.store.Store;
12 import com.openedit.store.StoreTestCase;
13
14 /**
15  * @author cburkey
16  *
17  */

18 public class OrderExportTest extends StoreTestCase
19 {
20     
21     /**
22      * @param inArg0
23      */

24     public OrderExportTest(String JavaDoc inArg0)
25     {
26         super(inArg0);
27     }
28     public void testConvertion() throws Exception JavaDoc
29     {
30         /*
31             CurrencyConvert con = new CurrencyConvert();
32             Fraction result = con.getMultiplier("euro","usa");
33             assertTrue( result.doubleValue() > 1.2);
34 */

35     }
36     public void testElectronicOrder() throws Exception JavaDoc
37     {
38         CartModule cartModule = (CartModule)getFixture().getModuleManager().getModule("CartModule");
39
40         WebPageRequest context = getFixture().createPageRequest();//"/store/index.html");
41
Store store = cartModule.getStore(context);
42
43         context.setRequestParameter( "productid", "1" );
44         cartModule.updateCart( context );
45
46         Cart cart = (Cart) context.getSessionValue( "cart" );
47         cart.setCustomer(createCustomer());
48         
49         cartModule.processOrder(context);
50
51         //make sure it was marked as classified
52
Order order = (Order)context.getPageValue("order");
53         assertNotNull(order);
54         
55         CartItem item = (CartItem)order.getItems().get(0);
56         assertEquals( "electronic-delivery", item.getProduct().getShippingMethodId() );
57
58         //assertEquals("/store/electronic/electronic-delivery.html",context.getPageValue("redirect"));
59
}
60 }
61
Popular Tags