RangerServiceDefServiceBase extends RangerBaseModelService<T, V> { public RangerEnumDef populateXXToRangerEnumDef(XXEnumDef xObj) { RangerEnumDef vObj = new RangerEnumDef(); vObj.setItemId(xObj.getItemId()); vObj.setName(xObj.getName()); vObj.setDefaultIndex(xObj.getDefaultindex()); List<XXEnumElementDef> xElements = daoMgr.getXXEnumElementDef().findByEnumDefId(xObj.getId()); List<RangerEnumElementDef> elements = new ArrayList<RangerEnumElementDef>(); for(XXEnumElementDef xEle : xElements) { RangerEnumElementDef element = populateXXToRangerEnumElementDef(xEle); elements.add(element); } vObj.setElements(elements); return vObj; } RangerServiceDefServiceBase(); XXServiceConfigDef populateRangerServiceConfigDefToXX(RangerServiceConfigDef vObj, XXServiceConfigDef xObj,
			XXServiceDef serviceDef, int operationContext); RangerServiceConfigDef populateXXToRangerServiceConfigDef(XXServiceConfigDef xObj); XXResourceDef populateRangerResourceDefToXX(RangerResourceDef vObj, XXResourceDef xObj,
			XXServiceDef serviceDef, int operationContext); RangerResourceDef populateXXToRangerResourceDef(XXResourceDef xObj); XXAccessTypeDef populateRangerAccessTypeDefToXX(RangerAccessTypeDef vObj, XXAccessTypeDef xObj,
			XXServiceDef serviceDef, int operationContext); RangerAccessTypeDef populateXXToRangerAccessTypeDef(XXAccessTypeDef xObj); XXPolicyConditionDef populateRangerPolicyConditionDefToXX(RangerPolicyConditionDef vObj,
			XXPolicyConditionDef xObj, XXServiceDef serviceDef, int operationContext); RangerPolicyConditionDef populateXXToRangerPolicyConditionDef(XXPolicyConditionDef xObj); XXContextEnricherDef populateRangerContextEnricherDefToXX(RangerContextEnricherDef vObj,
			XXContextEnricherDef xObj, XXServiceDef serviceDef, int operationContext); RangerContextEnricherDef populateXXToRangerContextEnricherDef(XXContextEnricherDef xObj); XXEnumDef populateRangerEnumDefToXX(RangerEnumDef vObj, XXEnumDef xObj, XXServiceDef serviceDef,
			int operationContext); RangerEnumDef populateXXToRangerEnumDef(XXEnumDef xObj); XXEnumElementDef populateRangerEnumElementDefToXX(RangerEnumElementDef vObj, XXEnumElementDef xObj,
			XXEnumDef enumDef, int operationContext); RangerEnumElementDef populateXXToRangerEnumElementDef(XXEnumElementDef xObj); XXDataMaskTypeDef populateRangerDataMaskDefToXX(RangerDataMaskTypeDef vObj, XXDataMaskTypeDef xObj,
														   XXServiceDef serviceDef, int operationContext); RangerDataMaskTypeDef populateXXToRangerDataMaskTypeDef(XXDataMaskTypeDef xObj); RangerServiceDefList searchRangerServiceDefs(SearchFilter searchFilter); String objectToJson(Serializable obj); DST jsonToObject(String jsonStr, Class<DST> clz);  }
@Test public void test18populateXXToRangerEnumDef() { XXEnumElementDefDao xEnumElementDefDao = Mockito .mock(XXEnumElementDefDao.class); List<XXEnumElementDef> enumElementDefList = new ArrayList<XXEnumElementDef>(); XXEnumElementDef enumElementDefObj = new XXEnumElementDef(); enumElementDefObj.setAddedByUserId(Id); enumElementDefObj.setCreateTime(new Date()); enumElementDefObj.setEnumdefid(Id); enumElementDefObj.setId(Id); enumElementDefObj.setLabel("Simple"); enumElementDefObj.setName("simple"); enumElementDefObj.setOrder(0); enumElementDefObj.setUpdatedByUserId(Id); enumElementDefObj.setUpdateTime(new Date()); enumElementDefList.add(enumElementDefObj); XXEnumDef enumDefObj = new XXEnumDef(); enumDefObj.setAddedByUserId(Id); enumDefObj.setCreateTime(new Date()); enumDefObj.setDefaultindex(0); enumDefObj.setDefid(Id); enumDefObj.setId(Id); enumDefObj.setName("authnType"); enumDefObj.setUpdatedByUserId(Id); enumDefObj.setUpdateTime(new Date()); Mockito.when(daoManager.getXXEnumElementDef()).thenReturn( xEnumElementDefDao); Mockito.when(xEnumElementDefDao.findByEnumDefId(enumDefObj.getId())) .thenReturn(enumElementDefList); RangerEnumDef dbRangerEnumDef = rangerServiceDefService .populateXXToRangerEnumDef(enumDefObj); Assert.assertNotNull(dbRangerEnumDef); Assert.assertEquals(dbRangerEnumDef.getName(), enumDefObj.getName()); Mockito.verify(daoManager).getXXEnumElementDef(); }