@Test
public void testGetResourcesForPermission() throws Exception {

  RoleAuthorizationEntity roleAuthorizationEntity = createNiceMock(RoleAuthorizationEntity.class);
  expect(roleAuthorizationEntity.getAuthorizationId()).andReturn("TEST.DO_SOMETHING").once();
  expect(roleAuthorizationEntity.getAuthorizationName()).andReturn("Do Something").once();
  List<RoleAuthorizationEntity> authorizationEntities = new ArrayList<RoleAuthorizationEntity>();
  authorizationEntities.add(roleAuthorizationEntity);
  PermissionEntity permissionEntry = createStrictMock(PermissionEntity.class);
  expect(permissionEntry.getAuthorizations()).andReturn(authorizationEntities).once();
  PermissionDAO permissionDAO = injector.getInstance(PermissionDAO.class);
  expect(permissionDAO.findById(1)).andReturn(permissionEntry).once();
  replayAll();
  AmbariManagementController managementController = injector.getInstance(AmbariManagementController.class);
  RoleAuthorizationResourceProvider provider = new RoleAuthorizationResourceProvider(managementController);
  Predicate predicate = new PredicateBuilder()
      .property(RoleAuthorizationResourceProvider.PERMISSION_ID_PROPERTY_ID).equals("1")
      .toPredicate();
  Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), predicate);
  Assert.assertEquals(1, resources.size());
  Resource resource = resources.iterator().next();
  Assert.assertEquals("TEST.DO_SOMETHING", resource.getPropertyValue(RoleAuthorizationResourceProvider.AUTHORIZATION_ID_PROPERTY_ID));
  Assert.assertEquals("Do Something", resource.getPropertyValue(RoleAuthorizationResourceProvider.AUTHORIZATION_NAME_PROPERTY_ID));
  Assert.assertEquals(1, resource.getPropertyValue(RoleAuthorizationResourceProvider.PERMISSION_ID_PROPERTY_ID));
  verifyAll();
}