HibernateDrugPurchaseOrderDAO implements DrugPurchaseOrderDAO { public void deleteDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder) { sessionFactory.getCurrentSession().delete(drugPurchaseOrder); }  void setSessionFactory(SessionFactory sessionFactory); DrugPurchaseOrder saveDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); DrugPurchaseOrder getDrugPurchaseOrderByUuid(String uuid); List<DrugPurchaseOrder> getAllDrugPurchaseOrders(); List<DrugPurchaseOrder> getAllDrugPurchaseOrdersNotReceived(); DrugPurchaseOrder updateDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); void deleteDrugPurchaseOrder(DrugPurchaseOrder drugPurchaseOrder); List<DrugPurchaseOrder> getDrugPurchaseOrderByProvider(Integer providerId); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByDispenseLocation(Integer dispenseLocation); @Override List<DrugPurchaseOrder> getDrugPurchaseOrderByStockLocation(Integer stockLocation);  }
@Test public void testDeleteDrugPurchaseOrder() { DrugPurchaseOrder dpOrder = new DrugPurchaseOrder(); Provider provider = new Provider(1); provider.setDateCreated(new Date()); Location location = new Location(1); location.setDateCreated(new Date()); dpOrder.setName("TestList4"); dpOrder.setDescription("Third Test List"); dpOrder.setCreator(Context.getUserContext().getAuthenticatedUser()); dpOrder.setDateCreated(new java.util.Date()); dpOrder.setDrugPurchaseOrderDate(new Date()); dpOrder.setUuid("68547121-1b70-465c-99ee-c9dfd95e7d30"); dpOrder.setRetired(Boolean.FALSE); dpOrder.setProviderId(new Integer(3)); dpOrder.setDispenseLocationId(new Integer(1)); dpOrder.setStockLocationId(new Integer(2)); dpOrder.setProvider(provider); dpOrder.setDispenseLocation(Context.getLocationService().getLocation(1)); dpOrder.setStockLocation(Context.getLocationService().getLocation(2)); dao.deleteDrugPurchaseOrder(dpOrder); DrugPurchaseOrder result = dao.getDrugPurchaseOrderByUuid("68547121-1b70-465c-99ee-c9dfd95e7d30"); assertEquals(result, null); }