@Test
public void testGetResources_viewNotLoaded() throws Exception {

  List<PermissionEntity> permissionEntities = new LinkedList<PermissionEntity>();
  PermissionEntity permissionEntity = createNiceMock(PermissionEntity.class);
  PermissionEntity viewUsePermissionEntity = createNiceMock(PermissionEntity.class);
  ResourceTypeEntity resourceTypeEntity = createNiceMock(ResourceTypeEntity.class);
  ViewEntity viewEntity = createMock(ViewEntity.class);
  permissionEntities.add(permissionEntity);
  expect(dao.findViewUsePermission()).andReturn(viewUsePermissionEntity);
  expect(dao.findAll()).andReturn(Collections.singletonList(permissionEntity));
  expect(permissionEntity.getResourceType()).andReturn(resourceTypeEntity);
  expect(viewEntity.isDeployed()).andReturn(false).anyTimes();
  expect(viewRegistry.getDefinition(resourceTypeEntity)).andReturn(viewEntity);
  replay(dao, permissionEntity, viewUsePermissionEntity, resourceTypeEntity, viewEntity, viewRegistry);
  ViewPermissionResourceProvider provider = new ViewPermissionResourceProvider();
  Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
  // built in permissions
  Assert.assertEquals(0, resources.size());
  verify(dao, permissionEntity, viewUsePermissionEntity, resourceTypeEntity, viewEntity, viewRegistry);
}