### Question:
RangerPolicyServiceBase extends
		RangerBaseModelService<T, V> { @Override @SuppressWarnings("unchecked") protected RangerPolicy mapEntityToViewBean(RangerPolicy vObj, XXPolicyBase xObj) { XXService xService = daoMgr.getXXService().getById(xObj.getService()); vObj.setGuid(xObj.getGuid()); vObj.setVersion(xObj.getVersion()); vObj.setService(xService.getName()); vObj.setName(xObj.getName()); vObj.setPolicyType(xObj.getPolicyType()); vObj.setDescription(xObj.getDescription()); vObj.setResourceSignature(xObj.getResourceSignature()); vObj.setIsEnabled(xObj.getIsEnabled()); vObj.setIsAuditEnabled(xObj.getIsAuditEnabled()); return vObj; } RangerPolicyServiceBase(); @SuppressWarnings("unchecked") RangerPolicyList searchRangerPolicies(SearchFilter searchFilter);  }### Answer:
@Test public void test3mapEntityToViewBean() { XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class); XXService xService = Mockito.mock(XXService.class); RangerPolicy rangerPolicy = rangerPolicy(); XXPolicy policy = policy(); Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao); Mockito.when(xServiceDao.getById(policy.getService())).thenReturn( xService); RangerPolicy dbRangerPolicy = policyService.mapEntityToViewBean( rangerPolicy, policy); Assert.assertNotNull(dbRangerPolicy); Assert.assertEquals(dbRangerPolicy.getId(), rangerPolicy.getId()); Assert.assertEquals(dbRangerPolicy.getGuid(), rangerPolicy.getGuid()); Assert.assertEquals(dbRangerPolicy.getName(), rangerPolicy.getName()); Assert.assertEquals(dbRangerPolicy.getIsEnabled(), rangerPolicy.getIsEnabled()); Assert.assertEquals(dbRangerPolicy.getVersion(), rangerPolicy.getVersion()); Assert.assertEquals(dbRangerPolicy.getDescription(), rangerPolicy.getDescription()); Mockito.verify(daoManager).getXXService(); }