@Test public void removeMenuItem() throws Exception { final int testId = 1; Collection<MenuItem> menuItems = menuService.getMenuItems(); final int initialSize = menuItems.size(); assertTrue(initialSize >= 1); final MenuItem origMenuItem = menuService.getMenuItem(testId); assertNotNull(origMenuItem); menuService.removeMenuItem(testId); final Collection<MenuItem> curMenuItems = menuService.getMenuItems(); assertTrue(curMenuItems.size() < initialSize); assertFalse(curMenuItems.contains(origMenuItem)); try { MenuItem menuItem = menuService.getMenuItem(testId); fail("Should have thrown MenuItemNotFoundException"); } catch (MenuItemNotFoundException e) { } }
public void removeMenuItem(int itemId) { menuItems.remove(itemId); }
MenuService { public void removeMenuItem(int itemId) { menuItems.remove(itemId); } }
MenuService { public void removeMenuItem(int itemId) { menuItems.remove(itemId); } MenuService(); }
MenuService { public void removeMenuItem(int itemId) { menuItems.remove(itemId); } MenuService(); int createMenuItem(MenuItem item); int createMenuItem(int itemId, MenuItem item); Collection<MenuItem> getMenuItems(); MenuItem getMenuItem(int itemId); void updateMenuItem(int itemId, MenuItem item); void removeMenuItem(int itemId); }
MenuService { public void removeMenuItem(int itemId) { menuItems.remove(itemId); } MenuService(); int createMenuItem(MenuItem item); int createMenuItem(int itemId, MenuItem item); Collection<MenuItem> getMenuItems(); MenuItem getMenuItem(int itemId); void updateMenuItem(int itemId, MenuItem item); void removeMenuItem(int itemId);  }