use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class RouterLinkTest method noImplicitRouter.
@Test(expected = IllegalStateException.class)
public void noImplicitRouter() {
VaadinService service = VaadinService.getCurrent();
Mockito.when(service.getRouter()).thenReturn(null);
new RouterLink("Show something", TestView.class);
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class EventUtilTest method setUp.
@Before
public void setUp() {
VaadinSession session = Mockito.mock(VaadinSession.class);
ui = new UI() {
@Override
public VaadinSession getSession() {
return session;
}
};
VaadinService service = Mockito.mock(VaadinService.class);
when(session.getService()).thenReturn(service);
DefaultInstantiator instantiator = new DefaultInstantiator(service);
when(service.getInstantiator()).thenReturn(instantiator);
UI.setCurrent(ui);
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class PolymerServerEventHandlersTest method createService.
@Override
protected VaadinService createService() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.isProductionMode()).thenReturn(true);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
return service;
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class CustomElementRegistryInitializerTest method createService.
@Override
protected VaadinService createService() {
VaadinService service = Mockito.mock(VaadinService.class);
DeploymentConfiguration configuration = Mockito.mock(DeploymentConfiguration.class);
Mockito.when(configuration.isProductionMode()).thenReturn(true);
Mockito.when(service.getDeploymentConfiguration()).thenReturn(configuration);
return service;
}
use of com.vaadin.flow.server.VaadinService in project flow by vaadin.
the class CustomElementRegistryInitializerTest method setup.
@Before
public void setup() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
Field customElements = CustomElementRegistry.class.getDeclaredField("customElements");
customElements.setAccessible(true);
customElements.set(CustomElementRegistry.getInstance(), new AtomicReference<>());
customElementRegistryInitializer = new CustomElementRegistryInitializer();
VaadinSession session = Mockito.mock(VaadinSession.class);
UI ui = new UI() {
@Override
public VaadinSession getSession() {
return session;
}
};
VaadinService service = Mockito.mock(VaadinService.class);
when(session.getService()).thenReturn(service);
DefaultInstantiator instantiator = new DefaultInstantiator(service);
when(service.getInstantiator()).thenReturn(instantiator);
UI.setCurrent(ui);
}
Aggregations