@Test public void testExecute__collection_nullInternalPredicate_nonNullUserPredicate() throws Exception {
  Result result=createNiceMock(Result.class);
  ResourceInstance clusterResourceInstance=createNiceMock(ResourceInstance.class);
  ResourceDefinition clusterResourceDefinition=createNiceMock(ResourceDefinition.class);
  Schema clusterSchema=createNiceMock(Schema.class);
  Resource clusterResource=createNiceMock(Resource.class);
  String clusterPropertyId="clusterId";
  Predicate userPredicate=createNiceMock(Predicate.class);
  Map<String,Set<String>> mapProperties=new HashMap<String,Set<String>>();
  mapProperties.put(null,Collections.singleton("clusterId"));
  TreeNode<Resource> tree=new TreeNodeImpl<Resource>(null,null,null);
  List<Resource> listResources=Collections.singletonList(clusterResource);
  Map<Resource.Type,String> mapResourceIds=new HashMap<Resource.Type,String>();
  expect(clusterResource.getType()).andReturn(Resource.Type.Cluster).anyTimes();
  expect(clusterResourceInstance.getIds()).andReturn(mapResourceIds).anyTimes();
  expect(clusterResourceInstance.getResourceDefinition()).andReturn(clusterResourceDefinition).anyTimes();
  expect(clusterResourceDefinition.getType()).andReturn(Resource.Type.Component).atLeastOnce();
  expect(m_controller.getSchema(Resource.Type.Component)).andReturn(clusterSchema).anyTimes();
  expect(clusterSchema.getCategoryProperties()).andReturn(mapProperties).anyTimes();
  expect(clusterSchema.getKeyPropertyId(Resource.Type.Component)).andReturn(clusterPropertyId).anyTimes();
  expect(result.getResultTree()).andReturn(tree).anyTimes();
  expect(m_controller.getResources(eq(Resource.Type.Component),eq(PropertyHelper.getReadRequest(Collections.singleton(clusterPropertyId))),eq(userPredicate))).andReturn(listResources);
  replay(m_controller,result,clusterResourceInstance,clusterResourceDefinition,clusterSchema,clusterResource,userPredicate);
  QueryImpl query=new TestQuery(clusterResourceInstance,result);
  query.setUserPredicate(userPredicate);
  query.execute();
  verify(m_controller,result,clusterResourceInstance,clusterResourceDefinition,clusterSchema,clusterResource,userPredicate);
  assertEquals("true",tree.getProperty("isCollection"));
  assertEquals(1,tree.getChildren().size());
  TreeNode<Resource> clusterNode=tree.getChild("Cluster:1");
  assertSame(clusterResource,clusterNode.getObject());
  assertEquals(0,clusterNode.getChildren().size());
}
