### Question:
PageInterceptor implements Interceptor { protected String buildOraclePageSql(Page<?> page, String sql) { int offset = (page.getPageNo() - 1) * page.getPageSize() + 1; StringBuilder sb = new StringBuilder(sql); sb.insert(0, "select u.*, rownum r from (").append(") u where rownum < ").append(offset + page.getPageSize()); sb.insert(0, "select * from (").append(") where r >= ").append(offset); return sb.toString(); }  String getDatabaseType(); void setDatabaseType(String databaseType); @Override Object plugin(Object target); @Override void setProperties(Properties properties); @Override @SuppressWarnings({ "unchecked", "rawtypes" }) Object intercept(Invocation invocation); static final String MYSQL; static final String ORACLE; }### Answer:
@Test public void testBuildOraclePageSql() { Page page = new Page(); page.setPageNo(2); page.setPageSize(10); String res = interceptor.buildOraclePageSql(page, "test_table"); assertEquals("select * from (select u.*, rownum r from (test_table) u where rownum < 21) where r >= 11", res); }