### Question:
MenuItemHelper { public static int eepromSizeForItem(MenuItem item) { return MenuItemHelper.visitWithResult(item, new AbstractMenuItemVisitor<Integer>() { @Override public void visit(AnalogMenuItem item) { setResult(2); } @Override public void visit(BooleanMenuItem item) { setResult(1); } @Override public void visit(EnumMenuItem item) { setResult(2); } @Override public void visit(EditableLargeNumberMenuItem numItem) { setResult(8); } @Override public void visit(EditableTextMenuItem item) { if(item.getItemType() == EditItemType.IP_ADDRESS) { setResult(4); } else if(item.getItemType() == EditItemType.PLAIN_TEXT) { setResult(item.getTextLength()); } else setResult(4); } @Override public void anyItem(MenuItem item) { setResult(0); } }).orElse(0); }  static Optional<T> visitWithResult(MenuItem item, AbstractMenuItemVisitor<T> visitor); static SubMenuItem asSubMenu(MenuItem item); static boolean isRuntimeStructureNeeded(MenuItem item); static MenuItem createFromExistingWithId(MenuItem selected, int newId); static int eepromSizeForItem(MenuItem item);  }### Answer:
@Test public void testEeepromSizeForItem() { assertEquals(0, MenuItemHelper.eepromSizeForItem(listItem)); assertEquals(2, MenuItemHelper.eepromSizeForItem(analogItem)); assertEquals(2, MenuItemHelper.eepromSizeForItem(enumItem)); assertEquals(0, MenuItemHelper.eepromSizeForItem(subItem)); assertEquals(1, MenuItemHelper.eepromSizeForItem(boolMenuItem)); assertEquals(10, MenuItemHelper.eepromSizeForItem(textItem)); assertEquals(4, MenuItemHelper.eepromSizeForItem(ipItem)); assertEquals(0, MenuItemHelper.eepromSizeForItem(floatItem)); assertEquals(0, MenuItemHelper.eepromSizeForItem(actionItem)); }