use of io.lumeer.core.cache.UserCache in project engine by Lumeer.
the class PermissionsCheckerTest method preparePermissionsChecker.
@Before
public void preparePermissionsChecker() {
User user = Mockito.mock(User.class);
Mockito.when(user.getGroups()).thenReturn(Collections.singletonMap("LMR", Collections.singleton(GROUP)));
UserCache userCache = Mockito.mock(UserCache.class);
Mockito.when(userCache.getUser(USER)).thenReturn(user);
AuthenticatedUser authenticatedUser = Mockito.mock(AuthenticatedUser.class);
Mockito.when(authenticatedUser.getCurrentUsername()).thenReturn(USER);
Mockito.when(authenticatedUser.getUserEmail()).thenReturn(USER);
Mockito.when(authenticatedUser.getCurrentUserGroups()).thenReturn(Collections.singleton(GROUP));
permissionsChecker = new PermissionsChecker(userCache, authenticatedUser);
}