1 4 package com.openedit.store; 5 6 7 10 public class PriceSupportTest extends StoreTestCase 11 { 12 PriceSupport itemPricing = new PriceSupport(); 13 PriceSupport productPricing = new PriceSupport(); 14 15 public PriceSupportTest( String name ) 16 { 17 super( name ); 18 } 19 20 public void setUp() 21 { 22 itemPricing.addTierPrice(1, createPrice(20) ); 23 itemPricing.addTierPrice(3, createPrice(19) ); 24 25 productPricing.addTierPrice( 1, createPrice(15) ); 26 productPricing.addTierPrice( 3, createPrice(14) ); 27 } 28 public void testGetPrice() 29 { 30 assertEquals( 20, itemPricing.getYourPriceByQuantity(1).doubleValue(), 0.001 ); 31 itemPricing.addTierPrice( 1, createPrice(21) ); 32 assertEquals( 21, itemPricing.getYourPriceByQuantity(1).doubleValue(), 0.001 ); 33 } 34 35 public void testGetPriceByQuantity() 36 { 37 assertEquals( 19, itemPricing.getYourPriceByQuantity(3).doubleValue(), 0.001 ); 38 itemPricing.getTiers().clear(); 39 assertEquals( 0, itemPricing.getYourPriceByQuantity(3).doubleValue(), 0.001 ); 40 itemPricing.addTierPrice( 1, createPrice(21) ); 41 assertEquals( 21, itemPricing.getYourPriceByQuantity(3).doubleValue(), 0.001 ); 42 itemPricing.addTierPrice( 3, createPrice(20) ); 43 assertEquals( 20, itemPricing.getYourPriceByQuantity(3).doubleValue(), 0.001 ); 44 45 } 46 47 48 } 49 | Popular Tags |