DiscountData extends AbstractJsonDataSavable { public void setCollection(ArrayList<Discount> discounts) { this.discounts.clear(); if (discounts != null) this.discounts.addAll(discounts); }  void addDiscount(Discount disc); void setCollection(ArrayList<Discount> discounts); List<Discount> getDiscounts(); Discount getADiscount(); Discount findFromBarcode(String code);  }
@Test public void setCollectionTest() throws ParseException { Discount d1 = new Discount("d1", 0.20, "2015-06-30", "2015-06-30", "", 2); Discount d2 = new Discount("d2", 0.20, "2015-06-30", "2015-06-30", "", 2); ArrayList<Discount> collection = new ArrayList<Discount>(); collection.add(d1); collection.add(d2); discountData.setCollection(collection); assertEquals(2, discountData.getDiscounts().size()); }