@Test
public void testCountXResource() {

	List<RangerPolicy> rangerPolicyList = new ArrayList<RangerPolicy>();
	List<VXResource> vXResourcesList = new ArrayList<VXResource>();
	RangerService rangerService = rangerService(Id);
	long i;
	for (i = 1; i <= 2; i++) {
		RangerPolicy rangerPolicy = rangerPolicy(i);
		VXResource vXresource = vxResource(i);
		rangerPolicyList.add(rangerPolicy);
		vXResourcesList.add(vXresource);
		Mockito.when(serviceUtil.toVXResource(rangerPolicy, rangerService)).thenReturn(vXresource);
	}
	VXLong expectedXResouce = new VXLong();
	expectedXResouce.setValue(2l);
	Mockito.when(serviceREST.getServiceByName(rangerPolicyList.get(0).getService())).thenReturn(rangerService);
	VXResourceList expectedVXResourceList = new VXResourceList();
	expectedVXResourceList.setVXResources(vXResourcesList);
	SearchFilter searchFilter = new SearchFilter();
	Mockito.when(searchUtil.getSearchFilterFromLegacyRequest(request, null)).thenReturn(searchFilter);
	Mockito.when(serviceREST.getPolicies(searchFilter)).thenReturn(rangerPolicyList);
	VXLong actualXResource = assetREST.countXResources(request);
	Assert.assertEquals(expectedXResouce.getValue(), actualXResource.getValue());
}