### Question:
JSPUtil { public static void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder) { if(sortField == null || sortField.isEmpty()) { sortField = "id"; } Arrays.sort(queryUnits, new QueryUnitComparator(sortField, "asc".equals(sortOrder))); }  static void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder); static void sortTaskRunner(List<TaskRunner> taskRunners); static String getElapsedTime(long startTime, long finishTime); static String getTajoMasterHttpAddr(Configuration config); static List<QueryMasterTask> sortQueryMasterTask(Collection<QueryMasterTask> queryMasterTasks,
                                                          final boolean desc); static List<QueryInProgress> sortQueryInProgress(Collection<QueryInProgress> queryInProgresses,
                                                          final boolean desc); static List<SubQuery> sortSubQuery(Collection<SubQuery> subQueries); static void sortFunctionDesc(List<FunctionDesc> functions); static String percentFormat(float value);  }### Answer:
@Test public void testSortQueryUnit() throws Exception { List<QueryUnit> queryUnits = new ArrayList<QueryUnit>(); Configuration conf = new TajoConf(); QueryUnitAttemptScheduleEvent.QueryUnitAttemptScheduleContext scheduleContext = new QueryUnitAttemptScheduleEvent.QueryUnitAttemptScheduleContext(); ExecutionBlockId ebId = TajoIdUtils.createExecutionBlockId("eb_000001_00001_00001"); for (int i = 0; i < 10; i++) { QueryUnitId id = new QueryUnitId(ebId, i); QueryUnit queryUnit = new QueryUnit(conf, scheduleContext, id, true, null); queryUnits.add(queryUnit); int launchTime = i + 1; int runningTime = i + 1; if(i < 9) { queryUnit.setLaunchTime(launchTime); queryUnit.setFinishTime(launchTime + runningTime); } } Collections.shuffle(queryUnits); QueryUnit[] queryUnitArray = queryUnits.toArray(new QueryUnit[]{}); JSPUtil.sortQueryUnit(queryUnitArray, "id", "asc"); for (int i = 0; i < 10; i++) { assertEquals(i, queryUnitArray[i].getId().getId()); } queryUnitArray = queryUnits.toArray(new QueryUnit[]{}); JSPUtil.sortQueryUnit(queryUnitArray, "id", "desc"); for (int i = 0; i < 10; i++) { assertEquals(9 - i, queryUnitArray[i].getId().getId()); } queryUnitArray = queryUnits.toArray(new QueryUnit[]{}); JSPUtil.sortQueryUnit(queryUnitArray, "runTime", "asc"); assertEquals(0, queryUnitArray[0].getId().getId()); assertEquals(9, queryUnitArray[9].getId().getId()); queryUnitArray = queryUnits.toArray(new QueryUnit[]{}); JSPUtil.sortQueryUnit(queryUnitArray, "runTime", "desc"); assertEquals(8, queryUnitArray[0].getId().getId()); assertEquals(9, queryUnitArray[9].getId().getId()); }