### Question:
PhysicalPlan extends TreeNode { public PhysicalPlan paginate(RangeNode<?> rangeNode) { if (!logicalPlan.getType().equals(SQLType.QUERY)) { return this; } Table table = logicalPlan.getQuery().getChildType(FromItem.class, 0).getChildType(Table.class, 0); String tableName = table.getChildType(IdentifierNode.class, 0).getValue(); rangeNode.setTable(tableName); PhysicalPlan paginatedPlan = (PhysicalPlan) this.clone(); if (whereClause == null) { paginatedPlan.whereClause = new WhereClause(); paginatedPlan.whereClause.addChildNode(rangeNode); } else { TreeNode whereClassNode = generatePage(whereClause.getChildNode(0), rangeNode, paginatedPlan.validateLogicalPlan()); TreeNode reducedWhereClassNode = processLogicalOperation((LogicalOperation) whereClassNode); paginatedPlan.whereClause.setChildNodes(Arrays.asList(reducedWhereClassNode)); } return paginatedPlan; } PhysicalPlan(String description, LogicalPlan logicalPlan); WhereClause getWhereClause(); Map<String, String> getColumnAliasMapping(); List<SelectItem> getSelectItems(); boolean validateLogicalPlan(); Color validateNode(TreeNode node); PhysicalPlan paginate(RangeNode<?> rangeNode); abstract List<String> getRangeCols(String table); abstract List<String> getQueryCols(String table); abstract RangeOperations<?> getRangeOperations(String table, String column); abstract boolean tableExists(String table); abstract boolean columnExists(String table, String column); abstract Map<String, Integer> getColumnTypeMap(String table); @Override Object clone(); boolean checkFilterNull(Comparator cmp, String value); boolean isFilterWithNull(FilterItem filterItem);  }### Answer:
@Test public void testPaginate(){ String sql = "Select * from myTable tbl"; LogicalPlan plan = getLogicalPlan(sql); DummyPhysicalPlan physicalPlan = new DummyPhysicalPlan("dummyPlan", plan); RangeNode<Long> rangeNode1 = new RangeNode<>("myTable", "column1"); rangeNode1.getRangeList().addRange(new Range<Long>(0l, Long.MAX_VALUE)); PhysicalPlan newPhysicalPlan = physicalPlan.paginate(rangeNode1); WhereClause actual = newPhysicalPlan.getWhereClause(); WhereClause expected = buildRangeClause(); assertEquals(expected, actual); }