@Test
public void testSearchXResource() {

	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);
	}
	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);
	VXResourceList actualVXResourceList = assetREST.searchXResources(request);
	Assert.assertNotNull(actualVXResourceList);
	Assert.assertEquals(expectedVXResourceList.getVXResources(), actualVXResourceList.getVXResources());
	Mockito.verify(searchUtil).getSearchFilterFromLegacyRequest(request, null);
	Mockito.verify(serviceREST).getPolicies(searchFilter);
	for (i = 0; i < 2; i++) {
		Mockito.verify(serviceUtil, Mockito.times(1)).toVXResource(rangerPolicyList.get((int) i), rangerService);
	}
	Mockito.verify(serviceREST, Mockito.times(2)).getServiceByName(rangerPolicyList.get(0).getService());
}