// 测试Discount的添加折扣商品函数
 @Test
 public void AddDiscountItem_and_AddGiveItem() {
   Discount dis = Discount.Initial();
   dis.ClearDiscount();
   dis.AddDiscountItem("ITEM000001");
   dis.AddDiscountItem("ITEM000002");
   dis.AddGiveItem("ITEM000001");
   dis.AddGiveItem("ITEM000003");
   PromotionType type1 = dis.IsPromotion("ITEM000001");
   assertEquals(type1, PromotionType.BUYTWOGIVEONE);
   PromotionType type2 = dis.IsPromotion("ITEM000002");
   assertEquals(type2, PromotionType.DISCOUNT);
   PromotionType type3 = dis.IsPromotion("ITEM000003");
   assertEquals(type3, PromotionType.BUYTWOGIVEONE);
   PromotionType type4 = dis.IsPromotion("ITEM000005");
   assertEquals(type4, PromotionType.NOPROMOTION);
 }
 @Test
 public void should_calculate_price_CalculatePrice() {
   Discount dis = Discount.Initial();
   dis.ClearDiscount();
   dis.AddGiveItem("ITEM000001");
   dis.AddDiscountItem("ITEM000005");
   PurchaseList list = new PurchaseList();
   list.AddPurchaseListItem("ITEM000001");
   list.AddPurchaseListItem("ITEM000001");
   list.AddPurchaseListItem("ITEM000001");
   list.AddPurchaseListItem("ITEM000002-2");
   list.AddPurchaseListItem("ITEM000005-3");
   list.ParsePurchaseList();
   Map<String, PurchaseItem> returnlist = list.getPurchaseList();
   PurchaseItem item1 = returnlist.get("ITEM000001");
   assertEquals(item1.getDiscountprice(), 98, 0.1);
   assertEquals(item1.getRealprice(), 294, 0.1);
   PurchaseItem item2 = returnlist.get("ITEM000002");
   assertEquals(item2.getDiscountprice(), 0, 0.1);
   assertEquals(item2.getRealprice(), 2, 0.1);
   PurchaseItem item3 = returnlist.get("ITEM000005");
   assertEquals(item3.getRealprice(), 9, 0.1);
   assertEquals(item3.getDiscountprice(), 0.45, 0.1);
 }