Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1. import junit.framework.TestCase;
  2.  
  3. /**
  4.  * A JUnit test case class.
  5.  * Every method starting with the word "test" will be called when running
  6.  * the test with JUnit.
  7.  */
  8. public class GroceryListTest extends TestCase {
  9.  
  10.   /**
  11.    * A test method.
  12.    * (Replace "X" with a name describing the test.  You may write as
  13.    * many "testSomething" methods in this class as you wish, and each
  14.    * one will be called when running JUnit over this class.)
  15.    */
  16.   GroceryListLinked grocery = new GroceryListLinked();
  17.  
  18.   GroceryItem milk = new GroceryItem("Milk", 2);
  19.   GroceryItem apples = new GroceryItem("Apples", 4);
  20.   GroceryItem shampoo = new GroceryItem("Shampoo", 11);
  21.  
  22.  
  23.  
  24.  
  25.   /*
  26.  
  27.   public void testRemove() {
  28.     grocery.add(milk);
  29.     grocery.add(apples);
  30.     grocery.add(shampoo);
  31.    
  32.     assertTrue(grocery.remove("Milk"));
  33.     assertTrue(grocery.remove("Apples"));
  34.     assertFalse(grocery.remove("Biscuits"));
  35.     assertFalse(grocery.remove("Soap"));
  36.   }
  37.  
  38.   public void testMarkAsBought() {
  39.     grocery.add(milk);
  40.     grocery.add(apples);
  41.     grocery.add(shampoo);
  42.  
  43.     assertTrue(grocery.markAsBought("Shampoo"));
  44.     assertTrue(grocery.markAsBought("Milk"));
  45.     assertTrue(grocery.markAsBought("Apples"));
  46.   }
  47.  
  48.   */
  49.   /*
  50.   public void testTotalQuantity() {
  51.     grocery.add(milk);
  52.     grocery.add(apples);
  53.     grocery.add(shampoo);
  54.    
  55.     assertEquals(17, grocery.totalQuantity());
  56.   }
  57.  
  58.   public void testReduceQuantity() {
  59.     grocery.add(milk);
  60.     grocery.add(apples);
  61.     grocery.add(shampoo);
  62.    
  63.     assertTrue(grocery.reduceQuantity("Milk", 2));
  64.     assertTrue(grocery.reduceQuantity("Apples", 2));
  65.     assertTrue(grocery.reduceQuantity("Shampoo", 10));
  66.   }*/
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement