Class MockSpringVaadinSession

java.lang.Object
com.vaadin.flow.server.VaadinSession
com.vaadin.flow.spring.SpringVaadinSession
com.github.mvysny.kaributesting.v10.spring.MockSpringVaadinSession
All Implemented Interfaces:
jakarta.servlet.http.HttpSessionBindingListener, Serializable, EventListener

public class MockSpringVaadinSession extends com.vaadin.flow.spring.SpringVaadinSession
A Vaadin Session with one important difference:
  • Creates a new session when this one is closed. This is used to simulate a logout which closes the session - we need to have a new fresh session to be able to continue testing. In order to do that, simply override close(), call `super.close()` then call MockVaadin.afterSessionClose(com.vaadin.flow.server.VaadinSession, kotlin.jvm.functions.Function0<? extends com.vaadin.flow.component.UI>).
See Also:
  • Field Summary

    Fields inherited from class com.vaadin.flow.server.VaadinSession

    browser
  • Constructor Summary

    Constructors
    Constructor
    Description
    MockSpringVaadinSession(@NotNull com.vaadin.flow.server.VaadinService service, @NotNull kotlin.jvm.functions.Function0<com.vaadin.flow.component.UI> uiFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class com.vaadin.flow.spring.SpringVaadinSession

    addDestroyListener, fireSessionDestroy

    Methods inherited from class com.vaadin.flow.server.VaadinSession

    access, accessSynchronously, addRequestHandler, addUI, checkHasLock, checkHasLock, createStreamResourceRegistry, findElement, getAllSessions, getAttribute, getAttribute, getBrowser, getConfiguration, getCumulativeRequestDuration, getCurrent, getErrorHandler, getLastLocked, getLastRequestDuration, getLastRequestTimestamp, getLastUnlocked, getLocale, getLockInstance, getNextUIid, getPendingAccessQueue, getPushId, getRequestHandlers, getResourceRegistry, getService, getSession, getState, getUIById, getUIs, hasLock, hasLock, lock, refreshTransients, removeRequestHandler, removeUI, setAttribute, setAttribute, setBrowser, setConfiguration, setCurrent, setErrorHandler, setLastRequestDuration, setLastRequestTimestamp, setLocale, setState, unlock, valueBound, valueUnbound

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MockSpringVaadinSession

      public MockSpringVaadinSession(@NotNull @NotNull com.vaadin.flow.server.VaadinService service, @NotNull @NotNull kotlin.jvm.functions.Function0<com.vaadin.flow.component.UI> uiFactory)
  • Method Details

    • close

      public void close()
      Overrides:
      close in class com.vaadin.flow.server.VaadinSession