@Test public void testPaginateFirstRow() { int firstRow = new Random().nextInt(1000); int maxRows = 0; String sql = UUID.randomUUID().toString(); String expectedSql = sql + "OFFSET " + firstRow + " ROWS "; assertEquals( expectedSql, queryTemplate.getSelectRender().getPaginationRender().paginateSQL(sql, firstRow, maxRows)); }
@Test public void testPaginateMaxRows() { int firstRow = -1; int maxRows = new Random().nextInt(1000) + 1; String sql = UUID.randomUUID().toString(); String expectedSql = sql + "LIMIT " + maxRows + " "; assertEquals( expectedSql, queryTemplate.getSelectRender().getPaginationRender().paginateSQL(sql, firstRow, maxRows)); }
@Test public void testPaginateNegativeParameters() { int firstRow = -1; int maxRows = -1; assertEquals( "sql", queryTemplate .getSelectRender() .getPaginationRender() .paginateSQL("sql", firstRow, maxRows)); }
@Test public void testInsertQuerySequence() { StringBuilder queryBuilder = new StringBuilder(); queryTemplate.getInsertRender().getFunctionsRender().sequence(queryBuilder, "sequence"); assertEquals("NEXT VALUE FOR sequence", queryBuilder.toString()); }