### Question:
RangerPolicyServiceBase extends
		RangerBaseModelService<T, V> { @SuppressWarnings("unchecked") public RangerPolicyList searchRangerPolicies(SearchFilter searchFilter) { List<RangerPolicy> policyList = new ArrayList<RangerPolicy>(); RangerPolicyList retList = new RangerPolicyList(); List<XXPolicy> xPolList = (List<XXPolicy>) searchResources(searchFilter, searchFields, sortFields, retList); for (XXPolicy xPol : xPolList) { policyList.add(populateViewBean((T) xPol)); } retList.setPolicies(policyList); return retList; } RangerPolicyServiceBase(); @SuppressWarnings("unchecked") RangerPolicyList searchRangerPolicies(SearchFilter searchFilter);  }### Answer:
@Test public void test4searchRangerPolicies() { EntityManager entityManager = Mockito.mock(EntityManager.class); SearchFilter searchFilter = new SearchFilter(); searchFilter.setParam(SearchFilter.POLICY_NAME, "policyName"); searchFilter.setParam(SearchFilter.SERVICE_NAME, "serviceName"); String searchString = "policyName"; String sortString = "asc"; List<SearchField> searchFieldList = new ArrayList<SearchField>(); boolean isCountQuery = false; BaseDao baseDao = Mockito.mock(BaseDao.class); Mockito.when(daoManager.getDaoForClassName(Mockito.anyString())) .thenReturn(baseDao); Mockito.when(daoManager.getEntityManager()).thenReturn(entityManager); Mockito.when( searchUtil .createSearchQuery(entityManager, searchString, sortString, searchFilter, searchFieldList, isCountQuery)).thenReturn(null); RangerPolicyList dbRangerPolicyList = policyService .searchRangerPolicies(searchFilter); Assert.assertNotNull(dbRangerPolicyList); Mockito.verify(daoManager).getDaoForClassName(Mockito.anyString()); }