use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testGetSystemAttributeNotPermitted.
@Test(expectedExceptions = MolgenisDataAccessException.class)
public void testGetSystemAttributeNotPermitted() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
Attribute attr = when(mock(Attribute.class).getIdentifier()).thenReturn("attr").getMock();
when(systemEntityType.getAllAttributes()).thenReturn(singletonList(attr));
when(permissionService.hasPermission(new EntityTypeIdentity(entityTypeId), EntityTypePermission.COUNT)).thenReturn(false);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertEquals(systemEntityTypeRegistry.getSystemAttribute("attr"), attr);
}
Aggregations