@Test public void testUpdateDrugGroup() { String nameSet = "NewDrugGroupName"; String nameRetrieved; DrugGroup drugGroup = dao.getDrugGroup(1); drugGroup.setName(nameSet); Set<Drug> drugs = new HashSet<Drug>(); Drug drug1 = new Drug(); Drug drug2 = new Drug(); drug1.setId(1); drug1.setConcept(new Concept(792)); drug2.setId(2); drug2.setConcept(new Concept(792)); drugs.add(drug1); drugs.add(drug2); drugGroup.setDrugs(drugs); dao.updateDrugGroup(drugGroup); nameRetrieved = dao.getDrugGroup(1).getName(); Set<Drug> resDrugs = dao.getDrugGroup(1).getDrugs(); assertEquals(nameSet, nameRetrieved); assertEquals(resDrugs.contains(drug1), true); assertEquals(resDrugs.contains(drug2), true); }
@Override public DrugGroup updateDrugGroup(DrugGroup drugGroup) throws DAOException { sessionFactory.getCurrentSession().update(drugGroup); return drugGroup; }
HibernateDrugGroupDAO implements DrugGroupDAO { @Override public DrugGroup updateDrugGroup(DrugGroup drugGroup) throws DAOException { sessionFactory.getCurrentSession().update(drugGroup); return drugGroup; } }
HibernateDrugGroupDAO implements DrugGroupDAO { @Override public DrugGroup updateDrugGroup(DrugGroup drugGroup) throws DAOException { sessionFactory.getCurrentSession().update(drugGroup); return drugGroup; }  }
HibernateDrugGroupDAO implements DrugGroupDAO { @Override public DrugGroup updateDrugGroup(DrugGroup drugGroup) throws DAOException { sessionFactory.getCurrentSession().update(drugGroup); return drugGroup; }  void setSessionFactory(SessionFactory sessionFactory); @Override DrugGroup saveDrugGroup(DrugGroup drugGroup); @Override void deleteDrugGroup(DrugGroup drugGroup); @Override DrugGroup getDrugGroup(Integer drugGroupId); @Override DrugGroup getDrugGroupByUuid(String uuid); @Override List<DrugGroup> getDrugGroupByName(String name); @Override List<DrugGroup> getAllDrugGroup(boolean includeRetired); @Override DrugGroup updateDrugGroup(DrugGroup drugGroup); }
HibernateDrugGroupDAO implements DrugGroupDAO { @Override public DrugGroup updateDrugGroup(DrugGroup drugGroup) throws DAOException { sessionFactory.getCurrentSession().update(drugGroup); return drugGroup; }  void setSessionFactory(SessionFactory sessionFactory); @Override DrugGroup saveDrugGroup(DrugGroup drugGroup); @Override void deleteDrugGroup(DrugGroup drugGroup); @Override DrugGroup getDrugGroup(Integer drugGroupId); @Override DrugGroup getDrugGroupByUuid(String uuid); @Override List<DrugGroup> getDrugGroupByName(String name); @Override List<DrugGroup> getAllDrugGroup(boolean includeRetired); @Override DrugGroup updateDrugGroup(DrugGroup drugGroup);  }