@Test public void getMenuItem() throws Exception { final Collection<MenuItem> menuItems = menuService.getMenuItems(); assertTrue(menuItems.size() >= 1); final MenuItem menuItem = menuService.getMenuItem(1); assertEquals(menuItems.iterator().next(), menuItem); }
public MenuItem getMenuItem(int itemId) throws MenuItemNotFoundException { MenuItem item = menuItems.get(itemId); if (item == null) { throw new MenuItemNotFoundException(itemId); } return item; }
MenuService { public MenuItem getMenuItem(int itemId) throws MenuItemNotFoundException { MenuItem item = menuItems.get(itemId); if (item == null) { throw new MenuItemNotFoundException(itemId); } return item; } }
MenuService { public MenuItem getMenuItem(int itemId) throws MenuItemNotFoundException { MenuItem item = menuItems.get(itemId); if (item == null) { throw new MenuItemNotFoundException(itemId); } return item; } MenuService(); }
MenuService { public MenuItem getMenuItem(int itemId) throws MenuItemNotFoundException { MenuItem item = menuItems.get(itemId); if (item == null) { throw new MenuItemNotFoundException(itemId); } return item; } 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 MenuItem getMenuItem(int itemId) throws MenuItemNotFoundException { MenuItem item = menuItems.get(itemId); if (item == null) { throw new MenuItemNotFoundException(itemId); } return item; } 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);  }