### Question:
MenuDao extends BaseDao<Menu> { public List<Menu> findByParentOid(String parentOid) { Criteria criteria = currentSession().createCriteria(Menu.class); criteria.add(Restrictions.eq("parentOid", parentOid)); criteria.addOrder(Order.asc("index")); return list(criteria); } @Inject  MenuDao(SessionFactory sessionFactory); List<Menu> findByModule(String names); List<Menu> findHierarchicalMenu(); List<Menu> findByParentOid(String parentOid);  }### Answer:
@Test public void findByParentOid() { Menu parent = super.createFrom(); Menu child = instance(); child.setParentOid(parent.getOid()); child = super.createFrom(child); List<Menu> menus = dao.findByParentOid(parent.getOid()); Assert.assertTrue(menus.size() == 1); Menu menu = menus.get(0); Assert.assertEquals(menu.getModule(), child.getModule()); Assert.assertEquals(menu.getPath(), child.getPath()); Assert.assertEquals(menu.getText(), child.getText()); super.deleteFrom(child); super.deleteFrom(parent); }