@Test
public void test11createServiceDef() throws Exception {

	XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class);
	XXResourceDefDao xResourceDefDao = Mockito.mock(XXResourceDefDao.class);
	XXServiceConfigDefDao xServiceConfigDefDao = Mockito
			.mock(XXServiceConfigDefDao.class);
	XXAccessTypeDefDao xAccessTypeDefDao = Mockito
			.mock(XXAccessTypeDefDao.class);
	XXPolicyConditionDefDao xPolicyConditionDefDao = Mockito
			.mock(XXPolicyConditionDefDao.class);
	XXContextEnricherDefDao xContextEnricherDefDao = Mockito
			.mock(XXContextEnricherDefDao.class);
	XXEnumDefDao xEnumDefDao = Mockito.mock(XXEnumDefDao.class);
	XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class);
	XXResourceDef xResourceDef = Mockito.mock(XXResourceDef.class);
	XXAccessTypeDef xAccessTypeDef = Mockito.mock(XXAccessTypeDef.class);
	List<XXAccessTypeDef> xAccessTypeDefs = new ArrayList<XXAccessTypeDef>();
	xAccessTypeDefs.add(xAccessTypeDef);
	List<XXResourceDef> xResourceDefs = new ArrayList<XXResourceDef>();
	xResourceDefs.add(xResourceDef);
	RangerServiceDef serviceDef = new RangerServiceDef();
	Mockito.when(serviceDefService.create(serviceDef)).thenReturn(
			serviceDef);
	Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
	Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
	Mockito.when(xServiceDefDao.getById(null)).thenReturn(xServiceDef);
	Mockito.when(daoManager.getXXServiceConfigDef()).thenReturn(
			xServiceConfigDefDao);
	Mockito.when(daoManager.getXXResourceDef()).thenReturn(xResourceDefDao);
	Mockito.when(xResourceDefDao.findByServiceDefId(xServiceDef.getId())).thenReturn(xResourceDefs);
	Mockito.when(daoManager.getXXAccessTypeDef()).thenReturn(
			xAccessTypeDefDao);
	Mockito.when(xAccessTypeDefDao.findByServiceDefId(xServiceDef.getId())).thenReturn(xAccessTypeDefs);
	Mockito.when(daoManager.getXXPolicyConditionDef()).thenReturn(
			xPolicyConditionDefDao);
	Mockito.when(daoManager.getXXContextEnricherDef()).thenReturn(
			xContextEnricherDefDao);
	Mockito.when(daoManager.getXXEnumDef()).thenReturn(xEnumDefDao);
	Mockito.when(serviceDefService.getPopulatedViewObject(xServiceDef))
			.thenReturn(serviceDef);
	RangerServiceDef dbServiceDef = serviceDBStore
			.createServiceDef(serviceDef);
	Assert.assertNotNull(dbServiceDef);
	Assert.assertEquals(dbServiceDef, serviceDef);
	Assert.assertEquals(dbServiceDef.getId(), serviceDef.getId());
	Assert.assertEquals(dbServiceDef.getCreatedBy(),
			serviceDef.getCreatedBy());
	Assert.assertEquals(dbServiceDef.getDescription(),
			serviceDef.getDescription());
	Assert.assertEquals(dbServiceDef.getGuid(), serviceDef.getGuid());
	Assert.assertEquals(dbServiceDef.getImplClass(),
			serviceDef.getImplClass());
	Assert.assertEquals(dbServiceDef.getLabel(), serviceDef.getLabel());
	Assert.assertEquals(dbServiceDef.getName(), serviceDef.getName());
	Assert.assertEquals(dbServiceDef.getRbKeyDescription(),
			serviceDef.getRbKeyDescription());
	Assert.assertEquals(dbServiceDef.getRbKeyLabel(), serviceDef.getLabel());
	Assert.assertEquals(dbServiceDef.getConfigs(), serviceDef.getConfigs());
	Assert.assertEquals(dbServiceDef.getVersion(), serviceDef.getVersion());
	Assert.assertEquals(dbServiceDef.getResources(),
			serviceDef.getResources());
	Mockito.verify(serviceDefService).getPopulatedViewObject(xServiceDef);
	Mockito.verify(serviceDefService).create(serviceDef);
	Mockito.verify(daoManager).getXXServiceConfigDef();
	Mockito.verify(daoManager).getXXEnumDef();
	Mockito.verify(daoManager).getXXAccessTypeDef();
}