コード例 #1
0
 public void testAddMoney() {
   try {
     customerManager.addMoney(1, 1.75);
     customerManager.addMoney(2, 2.50);
     customerManager.addMoney(3, 1.25);
     customerManager.addMoney(4, 1.50);
     assertEquals("Running total should be 1.75.", localVends.get(1).getRunningTotal(), 1.75);
     assertEquals("Running total should be 2.50.", localVends.get(2).getRunningTotal(), 2.50);
     assertEquals("Running total should be 1.25.", localVends.get(3).getRunningTotal(), 1.25);
     assertEquals("Running total should be 1.50.", localVends.get(4).getRunningTotal(), 1.50);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
 public void testAddToShoppingCart() {
   try {
     localVends.get(2).addItem(itemName, 2.00, Calendar.getInstance(), 2, 2, 2);
     customerManager.addToShoppingCart(2, 2, 2, 1);
     assertEquals(
         "Current amount of item in stock should be 1.",
         localVends.get(2).getTotalStock().get(new XYPair(2, 2)),
         (Integer) 1);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }