/** * Test of getProductsByCategory2 method, of class * thirdstage.exercise.spring.hibernate5.ProductDaoHibernateImpl3. */ public void testGetProductsByCategory2() throws Exception { System.out.println("getProductsByCategory2"); ProductDao dao = (ProductDao) (this.factory.getBean("productDao3")); String category = "cpu"; try { java.util.List<Product> result = dao.getProductsByCategory2(category); for (int i = 0, n = result.size(); i < n; i++) { System.out.println("" + result.get(i).getId() + ", " + result.get(i).getName()); } assertTrue(result.size() > 0); } catch (Exception ex) { System.out.println("fail"); ex.printStackTrace(System.out); } }