@Test public void testGetAllDrugInfo_shouldReturnAllDrugInfoIncludingRetired() { List<DrugInfo> allDrugInfo = dao.getAllDrugInfo(true); assertEquals(allDrugInfo.size(), 3); }
@Override public List<DrugInfo> getAllDrugInfo(boolean includeRetired) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); if (includeRetired == false) { criteria.add(Restrictions.eq("retired", false)); } return criteria.list(); }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getAllDrugInfo(boolean includeRetired) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); if (includeRetired == false) { criteria.add(Restrictions.eq("retired", false)); } return criteria.list(); } }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getAllDrugInfo(boolean includeRetired) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); if (includeRetired == false) { criteria.add(Restrictions.eq("retired", false)); } return criteria.list(); }  }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getAllDrugInfo(boolean includeRetired) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); if (includeRetired == false) { criteria.add(Restrictions.eq("retired", false)); } return criteria.list(); }  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); }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getAllDrugInfo(boolean includeRetired) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); if (includeRetired == false) { criteria.add(Restrictions.eq("retired", false)); } return criteria.list(); }  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);  }