@Test public void testRemoveAttribute() throws Exception { final Group createdGroup = groupDao.add(TestData.Group.getTestData()); groupDao.storeAttributes(createdGroup, TestData.Attributes.getTestData()); TestData.Attributes.assertEqualsTestData( groupDao.findByNameWithAttributes(TestData.DIRECTORY_ID, TestData.Group.NAME)); groupDao.removeAttribute(createdGroup, TestData.Attributes.ATTRIBUTE1); final GroupWithAttributes groupWithLessAttributes = groupDao.findByNameWithAttributes(TestData.DIRECTORY_ID, TestData.Group.NAME); assertNull(groupWithLessAttributes.getValue(TestData.Attributes.ATTRIBUTE1)); }
@Test public void testAddAndStoreAttributesAndFindGroupWithAttributesByName() throws Exception { final Group createdGroup = groupDao.add(TestData.Group.getTestData()); TestData.Group.assertEqualsTestGroup(createdGroup); groupDao.storeAttributes(createdGroup, TestData.Attributes.getTestData()); final GroupWithAttributes retrievedGroup = groupDao.findByNameWithAttributes(TestData.DIRECTORY_ID, TestData.Group.NAME); TestData.Group.assertEqualsTestGroup(retrievedGroup); TestData.Attributes.assertEqualsTestData(retrievedGroup); }