public void testGetSortedTablePage() {
List<String> taskIds = generateDummyTasks(15);
// With an ascending sort
ManagementService managementService = activitiRule.getManagementService();
TablePage tablePage = managementService.createTablePageQuery()
.tableName("ACT_RU_TASK")
.orderAsc("NAME_")
.listPage(1, 7);
String[] expectedTaskNames = new String[] {"B", "C", "D", "E", "F", "G", "H"};
verifyTaskNames(expectedTaskNames, tablePage.getRows());
// With a descending sort
tablePage = managementService.createTablePageQuery()
.tableName("ACT_RU_TASK")
.orderDesc("NAME_")
.listPage(6, 8);
expectedTaskNames = new String[] {"I", "H", "G", "F", "E", "D", "C", "B"} ;
verifyTaskNames(expectedTaskNames, tablePage.getRows());
TaskService taskService = activitiRule.getTaskService();
taskService.deleteTasks(taskIds, true);
}