### Question:
MenuItemHelper { public static SubMenuItem asSubMenu(MenuItem item) { return visitWithResult(item, new AbstractMenuItemVisitor<SubMenuItem>() { @Override public void visit(SubMenuItem item) { setResult(item); } @Override public void anyItem(MenuItem item) { } }).orElse(null); }  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 testSubMenuHelper() { assertEquals(subItem, MenuItemHelper.asSubMenu(subItem)); assertNull(MenuItemHelper.asSubMenu(enumItem)); assertNull(MenuItemHelper.asSubMenu(analogItem)); assertNull(MenuItemHelper.asSubMenu(floatItem)); }