001// Generated by delombok at Sun Jul 30 17:21:56 UTC 2023
002package de.cuioss.test.jsf.mocks;
003
004import java.util.Collection;
005import java.util.Collections;
006import javax.servlet.ServletContext;
007import org.apache.myfaces.test.mock.MockHttpSession;
008
009/**
010 * Extension to {@link MockHttpSession} that provides the programmatic setting
011 * of 'maxInactiveInterval'
012 *
013 * @author Oliver Wolff
014 */
015public class CuiMockHttpSession extends MockHttpSession {
016    private int maxInactiveInterval;
017
018    /**
019     * Constructor.
020     *
021     * @param servletContext must not be null
022     */
023    public CuiMockHttpSession(final ServletContext servletContext) {
024        super(servletContext);
025    }
026
027    @SuppressWarnings("unchecked")
028    @Override
029    public void invalidate() {
030        Collection<String> names = Collections.list(super.getAttributeNames());
031        names.forEach(super::removeAttribute);
032    }
033
034    @java.lang.SuppressWarnings("all")
035    @lombok.Generated
036    public int getMaxInactiveInterval() {
037        return this.maxInactiveInterval;
038    }
039
040    @java.lang.SuppressWarnings("all")
041    @lombok.Generated
042    public void setMaxInactiveInterval(final int maxInactiveInterval) {
043        this.maxInactiveInterval = maxInactiveInterval;
044    }
045}