### Question:
RowValueConstructorExpressionRewriter { public RowValueConstructorExpression rewriteAllChildrenAsc( RowValueConstructorExpression rvcExpression) throws SQLException { List<Expression> replacementChildren = new ArrayList<>(rvcExpression.getChildren().size()); for (int i = 0; i < rvcExpression.getChildren().size(); i++) { Expression child = rvcExpression.getChildren().get(i); if (child.getSortOrder() == SortOrder.DESC) { child = CoerceExpression.create(child, child.getDataType(), SortOrder.ASC, null); } replacementChildren.add(child); } return rvcExpression.clone(replacementChildren); }  static RowValueConstructorExpressionRewriter getSingleton(); RowValueConstructorExpression rewriteAllChildrenAsc(
            RowValueConstructorExpression rvcExpression);  }### Answer:
@Test public void testRewriteAllChildrenAsc() throws SQLException { Expression ascChild = Mockito.mock(Expression.class); Mockito.when(ascChild.getSortOrder()).thenReturn(SortOrder.ASC); Mockito.when(ascChild.getDataType()).thenReturn(PFloat.INSTANCE); Mockito.when(ascChild.getDeterminism()).thenReturn(Determinism.ALWAYS); Mockito.when(ascChild.requiresFinalEvaluation()).thenReturn(true); Expression descChild = Mockito.mock(Expression.class); Mockito.when(descChild.getSortOrder()).thenReturn(SortOrder.DESC); Mockito.when(descChild.getDataType()).thenReturn(PFloat.INSTANCE); Mockito.when(descChild.getDeterminism()).thenReturn(Determinism.ALWAYS); Mockito.when(descChild.requiresFinalEvaluation()).thenReturn(true); List<Expression> children = ImmutableList.of(ascChild,descChild); RowValueConstructorExpression expression = new RowValueConstructorExpression(children,false); RowValueConstructorExpressionRewriter rewriter = RowValueConstructorExpressionRewriter.getSingleton(); RowValueConstructorExpression result = rewriter.rewriteAllChildrenAsc(expression); assertEquals(2,result.getChildren().size()); Expression child1 = result.getChildren().get(0); Expression child2 = result.getChildren().get(1); assertEquals(SortOrder.ASC, child1.getSortOrder()); assertEquals(SortOrder.ASC, child2.getSortOrder()); assertEquals(ascChild, child1); assertTrue(child2 instanceof CoerceExpression); assertEquals(descChild, ((CoerceExpression)child2).getChild()); }