use of org.molgenis.security.core.UserPermissionEvaluator in project molgenis by molgenis.
the class MolgenisAccessDecisionVoterTest method setUp.
@BeforeMethod
public void setUp() {
UserPermissionEvaluator permissionService = mock(UserPermissionEvaluator.class);
when(permissionService.hasPermission(new PluginIdentity("plugingranted"), PluginPermission.READ)).thenReturn(true);
when(permissionService.hasPermission(new PluginIdentity("plugindenied"), PluginPermission.READ)).thenReturn(false);
Ui molgenisUi = mock(Ui.class);
UiMenu menu = mock(UiMenu.class);
when(molgenisUi.getMenu("menugranted")).thenReturn(menu);
when(molgenisUi.getMenu("menudenied")).thenReturn(null);
ApplicationContext ctx = mock(ApplicationContext.class);
when(ctx.getBean(UserPermissionEvaluator.class)).thenReturn(permissionService);
when(ctx.getBean(Ui.class)).thenReturn(molgenisUi);
new ApplicationContextProvider().setApplicationContext(ctx);
}
Aggregations