HibernateDrugInfoDAO implements DrugInfoDAO { @Override public DrugInfo saveDrugInfo(DrugInfo drugInfo) throws DAOException { sessionFactory.getCurrentSession().saveOrUpdate(drugInfo); return drugInfo; }  void setSessionFactory(SessionFactory sessionFactory); @Override DrugInfo saveDrugInfo(DrugInfo drugInfo); @Override void deleteDrugInfo(DrugInfo drugInfo); @Override DrugInfo getDrugInfo(Integer drugInfoId); @Override DrugInfo getDrugInfoByUuid(String uuid); @Override List<DrugInfo> getDrugInfoByName(String name); @Override DrugInfo getDrugInfoByDrug(Integer id); @Override List<DrugInfo> getAllDrugInfo(boolean includeRetired); @Override DrugInfo updateDrugInfo(DrugInfo drugInfo);  }
@Test public void testSaveDrugInfo() { DrugInfo drugInfo = new DrugInfo(); Drug drug = new Drug(); drug.setId(3); drugInfo.setDrug(drug); drugInfo.setDrugId(drug.getId()); drugInfo.setName("TestDrugInfo3"); drugInfo.setDescription("Third Test DrugInfo"); drugInfo.setCreator(Context.getUserContext().getAuthenticatedUser()); drugInfo.setDateCreated(new java.util.Date()); drugInfo.setUuid("68547121-1b70-465c-99ef-c9dfd95e7d30"); drugInfo.setRetired(Boolean.FALSE); dao.saveDrugInfo(drugInfo); DrugInfo result = dao.getDrugInfoByUuid("68547121-1b70-465c-99ef-c9dfd95e7d30"); String name = result.getName(); assertEquals(name, "TestDrugInfo3"); }