final String userName = "gp";
final String firstName = "Gerhard";
final String lastName = "Petracek";
UserRepository mockedUserRepository = mock(JpaUserRepository.class); //don't use the interface here to avoid issues with mockito and cdi proxies
when(mockedUserRepository.loadUser(userName)).thenReturn(new User(userName, firstName, lastName.toUpperCase() /*just to illustrate that the mock-instance is used*/));
mockManager.addMock(mockedUserRepository);
this.windowContext.activateWindow("testWindow");