SessionResolverImpl implements SessionResolver { @Override public Optional<MenuSession> getSession(Player player) { return Optional.ofNullable(playerSessions.get(player)); } SessionResolverImpl(); @Override Collection<MenuSession> findAllByTemplate(MenuTemplate menuTemplate); @Override Optional<MenuSession> getSession(Player player); @Override Optional<PaginatedMenuSession> getLastPaginatedSession(Player player);  }
@Test public void getSession() { MenuSession vasyaSes = apiInstance.getMenuFactory().createSingleSession(vasya, randomTemplate); sessionResolver.addNewSession(vasyaSes); MenuSession petyaSes = apiInstance.getMenuFactory().createSingleSession(petya, randomTemplate); sessionResolver.addNewSession(petyaSes); Optional<MenuSession> session = sessionResolver.getSession(vasya); assertTrue(session.isPresent()); assertEquals(session.get(), vasyaSes); Optional<MenuSession> session1 = sessionResolver.getSession(petya); assertTrue(session1.isPresent()); assertEquals(session1.get(), petyaSes); }