package fr.pierrelemee.sessions;

import fr.pierrelemee.SessionManager;

import java.util.LinkedHashMap;
import java.util.Map;

public class InMemorySessionManager extends SessionManager<SimpleSession> {

    public static final String COOKIE_NAME = "ptossnid";

    protected Map<String, SimpleSession> sessions;

    public InMemorySessionManager() {
        super(SimpleSession::new);
        this.sessions = new LinkedHashMap<>();
    }

    @Override
    public String getSessionCookieName() {
        return COOKIE_NAME;
    }

    @Override
    public boolean hasSession(String hash) {
        return this.sessions.containsKey(hash);
    }

    @Override
    public SimpleSession getSession(String hash) {
        return this.sessions.get(hash);
    }

    @Override
    protected void addSession(SimpleSession session) {
        this.sessions.put(session.getHash(), session);
    }
}

@@ -27,16 +27,47 @@
 sions;%0A%0A
+import fr.pierrelemee.Session;%0A
 import f
@@ -913,11 +913,219 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void destroySession(SimpleSession session) %7B%0A        this.sessions.remove(session);%0A    %7D%0A%0A    @Override%0A    public void flush(Session session) %7B%0A        // Nothing to do here%0A    %7D
 %0A%7D%0A

Fix tests