BakedItemList { public String generateReportByPrice() { BakedItem[] itemListCopy = Arrays.copyOf(itemList, itemCount); Arrays.sort(itemListCopy, new PriceComparator()); String result = "---------------------------------------\n" + "Report for Auburn's Best Bakery (by Price)\n" + "---------------------------------------\n\n"; for (int i = 0; i < itemCount; i++) { result += itemListCopy[i].toString() + "\n\n"; } return result; } BakedItemList(); String getListName(); void setListName(String listNamein); BakedItem[] getItemList(); void setItemList(BakedItem[] itemListin); int getItemCount(); void setItemCount(int itemCountin); String[] getExcludedRecords(); void setExcludedRecords(String[] excludedRecordsin); int getExcludedCount(); void setExcludedCount(int excludedCountin); static int getListCount(); static void resetListCount(); void readItemFile(String fileName); String generateReport(); String generateReportByClass(); String generateReportByPrice(); String generateReportByFlavor(); String generateExcludedRecordsReport();  }
@Test public void generateReportByPrice() throws Exception { BakedItemList b = new BakedItemList(); b.readItemFile("baked_item_data.csv"); String result = "---------------------------------------\n" + "Report for Auburn's Best Bakery (by Price)\n" + "---------------------------------------\n" + "\n" + "Cookie: Chips Delight - Chocolate Chip " + "Quantity: 12 Price: $4.20\n" + "(Ingredients: flour, sugar, dark chocolate chips, butter, baking" + " soda, \n" + "salt)\n" + "\n" + "Cake: Birthday - Chocolate Quantity: 1 " + "Price: $8.00\n" + "(Ingredients: flour, sugar, cocoa powder, vanilla, eggs, \n" + "butter, baking soda, baking powder, salt)\n" + "\n" + "Pie: Weekly Special - Apple Quantity: 1 " + "Price: $12.00\n" + "(Ingredients: flour, sugar, apple, cinnamon, butter, \n" + "baking soda, salt)\n" + "\n" + "Pie: Summer Special - Key Lime " + "Quantity: 1 Price: $14.00\n" + "(Ingredients: flour, sugar, lime juice, lemon juice, graham " + "crackers, \n" + "butter, baking soda, salt)\n" + "\n" + "Cake: 2-Layer - Red Velvet Quantity: 1 " + "Price: $16.00\n" + "(Ingredients: flour, sugar, cocoa powder, food coloring, eggs, " + "\nbutter, baking soda, baking powder, salt)\n" + "\n" + "WeddingCake: 3-Layer/3-Tier - Vanilla " + "Quantity: 1 Price: $135.00\n" + "(Ingredients: flour, sugar, buttermilk, coffee, eggs, \n" + "butter, baking soda, baking powder, salt)\n" + "\n"; Assert.assertEquals(result, b.generateReportByPrice()); }