Search in sources :

Example 1 with MockServletContext

use of com.vaadin.flow.server.MockServletContext in project flow by vaadin.

the class RouteConfigurationTest method init.

@Before
public void init() {
    servletContext = new MockServletContext();
    vaadinContext = new MockVaadinContext(servletContext);
    registry = ApplicationRouteRegistry.getInstance(vaadinContext);
    vaadinService = Mockito.mock(MockService.class);
    Mockito.when(vaadinService.getRouteRegistry()).thenReturn(registry);
    Mockito.when(vaadinService.getContext()).thenReturn(vaadinContext);
    VaadinService.setCurrent(vaadinService);
    session = new MockVaadinSession(vaadinService) {

        @Override
        public VaadinService getService() {
            return vaadinService;
        }
    };
}
Also used : MockVaadinContext(com.vaadin.flow.server.MockVaadinContext) MockVaadinSession(com.vaadin.flow.server.MockVaadinSession) VaadinService(com.vaadin.flow.server.VaadinService) MockServletContext(com.vaadin.flow.server.MockServletContext) Before(org.junit.Before)

Aggregations

MockServletContext (com.vaadin.flow.server.MockServletContext)1 MockVaadinContext (com.vaadin.flow.server.MockVaadinContext)1 MockVaadinSession (com.vaadin.flow.server.MockVaadinSession)1 VaadinService (com.vaadin.flow.server.VaadinService)1 Before (org.junit.Before)1