HibernateDrugInventoryDAO implements DrugInventoryDAO { @Override public List<DrugInventory> getDrugInventoriesByDrugPurchaseOrder(Integer drugPurchaseOrderId) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInventory.class); criteria.add(Restrictions.eq("drugPurchaseOrderId", drugPurchaseOrderId)); List<DrugInventory> drugInventories = new ArrayList<DrugInventory>(); drugInventories.addAll(criteria.list()); return drugInventories; }  void setSessionFactory(SessionFactory sessionFactory); DrugInventory saveDrugInventory(DrugInventory drugInventory); void deleteDrugInventory(DrugInventory drugInventory); DrugInventory getDrugInventoryByUuid(String uuid); List<DrugInventory> getAllDrugInventories(); List<DrugInventory> getAllDrugInventoriesByStatus(String status); DrugInventory updateDrugInventory(DrugInventory drugInventory); List<DrugInventory> getDrugInventoryByProvider(Integer providerId); @Override List<DrugInventory> getDrugInventoriesByLocation(Integer location); @Override List<DrugInventory> getDrugInventoriesByDrugPurchaseOrder(Integer drugPurchaseOrderId);  }
@Test public void testGetDrugInventoryByDrugPurchaseOrder() { List<DrugInventory> result = dao.getDrugInventoriesByDrugPurchaseOrder(1); assertEquals(result.size(), 1); }