### Question:
HibernateAttributeSetDAO extends HibernatePersistentObjectDAO<AttributeSet> implements AttributeSetDAO { @Override public boolean store(AttributeSet set) throws PersistenceException { if (!checkStoringAspect()) return false; for (Attribute att : set.getAttributes().values()) { att.setSetId(set.getId()); } boolean result = super.store(set); for (Attribute att : set.getAttributes().values()) att.setSetId(set.getId()); super.store(set); optionsDao.deleteOrphaned(set.getId(), set.getAttributeNames()); List<Template> templates = templateDao.findAll(set.getTenantId()); for (Template template : templates) { templateDao.initialize(template); List<String> names = template.getAttributeNames(set.getId()); for (String name : names) { Attribute setAttribute = set.getAttribute(name); if (setAttribute != null) { Attribute templateAttribute = template.getAttribute(name); int actualPosition = templateAttribute.getPosition(); try { Attribute clonedAttribute = (Attribute) setAttribute.clone(); clonedAttribute.setPosition(actualPosition); template.getAttributes().put(name, clonedAttribute); } catch (CloneNotSupportedException e) { } } else { template.removeAttribute(name); } } templateDao.store(template); } return result; } HibernateAttributeSetDAO(); @Override List<AttributeSet> findAll(); @Override List<AttributeSet> findAll(long tenantId); @Override AttributeSet findByName(String name, long tenantId); @Override boolean delete(long id, int code); @Override List<AttributeSet> findByType(int type, long tenantId); void setOptionsDao(AttributeOptionDAO optionsDao); @Override boolean store(AttributeSet set); void setTemplateDao(TemplateDAO templateDao); @Override Map<Long, AttributeSet> load(long tenantId); @Override Map<String, Attribute> findAttributes(long tenantId, Long setId);  }### Answer:
@Test public void testStore() throws PersistenceException { AttributeSet set = new AttributeSet(); set.setName("test3"); set.setValue("a1", "v1"); set.setValue("a2", "v2"); Assert.assertTrue(dao.store(set)); set = dao.findById(set.getId()); Assert.assertEquals("test3", set.getName()); Assert.assertTrue(set.getAttributes().containsKey("a1")); Assert.assertTrue(set.getAttributes().containsKey("a2")); }