@Test
public void test3mapEntityToViewBean() {

	XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
	XXService xService = Mockito.mock(XXService.class);
	XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class);
	XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class);
	RangerPolicy rangerPolicy = rangerPolicy();
	XXPolicy policy = policy();
	Mockito.when(daoManager.getXXService()).thenReturn(xServiceDao);
	Mockito.when(xServiceDao.getById(policy.getService())).thenReturn(
			xService);
	Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
	Mockito.when(xServiceDefDao.getById(xService.getType())).thenReturn(
			xServiceDef);
	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();
}