InMemoryResourceOwnerRepository implements ResourceOwnerStore, ResourceOwnerAuthentication, SessionSecurity { @Override public Boolean exists(Session session) { return sessions.contains(session); } @Inject  InMemoryResourceOwnerRepository(TokenGenerator tokenGenerator); @Override void save(ResourceOwner resourceOwner); @Override Optional<Session> auth(String username, String password, String remoteAddress); @Override Boolean exists(Session session);  }
@Test public void notExistingSession() throws Exception { Session session = new Session("session123"); Boolean sessionIsPresented = repository.exists(session); assertFalse(sessionIsPresented); }