use of com.vaadin.server.VaadinService in project SORMAS-Project by hzi-braunschweig.
the class CaseControllerTest method initUI.
@Before
public void initUI() throws Exception {
creator.createUser(null, null, null, "ad", "min", UserRole.ADMIN, UserRole.NATIONAL_USER);
VaadinRequest request = Mockito.mock(VaadinServletRequest.class);
when(request.getUserPrincipal()).thenReturn((Principal) () -> "admin");
CurrentInstance.set(VaadinRequest.class, request);
VaadinService service = Mockito.mock(VaadinService.class);
CurrentInstance.set(VaadinService.class, service);
VaadinSession session = Mockito.mock(VaadinSession.class);
ConverterFactory converterFactory = new SormasDefaultConverterFactory();
when(session.getConverterFactory()).thenReturn(converterFactory);
when(session.getService()).thenReturn(service);
CurrentInstance.set(VaadinSession.class, session);
ui = new SormasUI();
CurrentInstance.set(UI.class, ui);
java.lang.reflect.Field pageField = UI.class.getDeclaredField("page");
pageField.setAccessible(true);
pageField.set(ui, Mockito.mock(Page.class));
}
Aggregations