@Test
public void test2mapEntityToViewBean() {

	XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class);
	XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class);
	RangerService rangerService = rangerService();
	XXService service = service();
	XXServiceVersionInfoDao xServiceVersionInfoDao = Mockito.mock(XXServiceVersionInfoDao.class);
	XXServiceVersionInfo serviceVersionInfo = new XXServiceVersionInfo();
	serviceVersionInfo.setServiceId(service.getId());
	serviceVersionInfo.setPolicyVersion(service.getPolicyVersion());
	serviceVersionInfo.setPolicyUpdateTime(service.getPolicyUpdateTime());
	serviceVersionInfo.setTagVersion(service.getTagVersion());
	serviceVersionInfo.setPolicyUpdateTime(service.getTagUpdateTime());
	Mockito.when(daoManager.getXXServiceVersionInfo()).thenReturn(xServiceVersionInfoDao);
	Mockito.when(xServiceVersionInfoDao.findByServiceId(service.getId())).thenReturn(
			serviceVersionInfo);
	Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
	Mockito.when(xServiceDefDao.getById(service.getType())).thenReturn(
			xServiceDef);
	RangerService dbRangerService = rangerServiceService
			.mapEntityToViewBean(rangerService, service);
	Assert.assertNotNull(dbRangerService);
	Assert.assertEquals(dbRangerService, rangerService);
	Assert.assertEquals(dbRangerService.getDescription(),
			rangerService.getDescription());
	Assert.assertEquals(dbRangerService.getGuid(), rangerService.getGuid());
	Assert.assertEquals(dbRangerService.getName(), rangerService.getName());
	Assert.assertEquals(dbRangerService.getId(), rangerService.getId());
	Assert.assertEquals(dbRangerService.getVersion(),
			rangerService.getVersion());
	Assert.assertEquals(dbRangerService.getType(), rangerService.getType());
	Mockito.verify(daoManager).getXXServiceDef();
}