MenuSessionImpl implements MenuSession { @Override public Optional<MenuItem> getItemByIndex(int index) { return Optional.ofNullable(itemsByIndex.get(index)); } protected  MenuSessionImpl(MenuTemplate menuTemplate, MenuOpenProcessor openProcessor, Player owner, Consumer<Map<String, Object>> headerConsumer); @Override Optional<MenuItem> getItemByIndex(int index); @Override MenuTemplate getTemplate(); @Override Player getOwner(); @Override boolean isOpeningFinished(); @Override void close(); @Override void sendHeader(Map<String, Object> headers); @Override Inventory getInventory(); @Nonnull @Override Consumer<Map<String, Object>> getHeaderConsumer(); @Override void updateItems(); @Override void updateItem(int index); @Override void updateTemplate(MenuTemplate menuTemplate); @Override void setHeaderConsumer(@Nonnull Consumer<Map<String, Object>> consumer);  }
@Test public void getItemByIndex() { assertTrue(session.getItemByIndex(2).isPresent()); assertTrue(session.getItemByIndex(16).isPresent()); assertEquals(session.getItemByIndex(2).get(), item1); assertEquals(session.getItemByIndex(16).get(), item2); }