return result.toArray(new Object[result.size()][]);
}
@Test
public void testUsesRoleService() {
RoleService mockRoleService = Mockito.mock(RoleService.class);
new RoleAccess().addRoleService(mockRoleService);
AbstractComponent mockComponent = Mockito.mock(AbstractComponent.class);
Mockito.when(mockPlatform.getCurrentUser()).thenReturn(mockUser);
Mockito.when(mockUser.getUserId()).thenReturn("testUser1");
Mockito.when(mockUser.getDisciplineId()).thenReturn("testGroup1");
Mockito.when(mockComponent.getOwner()).thenReturn("testRole1");
Mockito.verifyZeroInteractions(mockRoleService);
PolicyContext context = new PolicyContext();
context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), pseudoComponent);
Mockito.when(mockRoleService.hasRole(Mockito.<User>any(), Mockito.anyString())).thenReturn(false);
Assert.assertFalse(ownershipPolicy.execute(context).getStatus());
Mockito.when(mockRoleService.hasRole(Mockito.<User>any(), Mockito.anyString())).thenReturn(true);
Assert.assertTrue(ownershipPolicy.execute(context).getStatus());
new RoleAccess().removeRoleService(mockRoleService);
}