### Question:
HibernateUtils { public static String removeSelect(String queryString) { queryString = queryString.replaceAll("[\\f\\n\\r\\t\\v]", " "); String regex = "^select .* from "; String[] ss = queryString.split(regex); if (ss.length > 0) { return "from " + ss[1]; } else { return queryString; } }  static String removeOrderBy(String queryString); static String removeSelect(String queryString);  }### Answer:
@Test public void removeSelect_simple() { String sql1 = "select a,b"; String sql2 = "from A2 where a=1 order by a asc"; String sql = sql1 + " " + sql2; Assert.assertEquals(sql2, HibernateUtils.removeSelect(sql)); }
@Test public void removeSelect_childselect() { String sql1 = "select a,b,(select c,d from A1 where c=1 order by c desc),d"; String sql2 = "from A2 where a=1 order by a asc"; String sql = sql1 + " " + sql2; Assert.assertEquals(sql2, HibernateUtils.removeSelect(sql)); }