### Question:
SqlQueryParser implements QueryParser { protected Ordering parseOrdering( TokenStream tokens, TypeSystem typeSystem, Source source ) { DynamicOperand operand = parseDynamicOperand(tokens, typeSystem, source); Order order = Order.ASCENDING; if (tokens.canConsume("DESC")) order = Order.DESCENDING; if (tokens.canConsume("ASC")) order = Order.ASCENDING; return ordering(operand, order); }  String getLanguage(); @Override String toString(); @Override boolean equals( Object obj ); QueryCommand parseQuery( String query,
                                    TypeSystem typeSystem ); static final String LANGUAGE; }### Answer:
@Test public void shouldParseOrderingFromDynamicOperandFollowedByAscendingKeyword() { Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) ASC"), typeSystem, mock(Source.class)); assertThat(ordering.operand(), is(instanceOf(NodeName.class))); assertThat(ordering.order(), is(Order.ASCENDING)); }
@Test public void shouldParseOrderingFromDynamicOperandFollowedByDecendingKeyword() { Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) DESC"), typeSystem, mock(Source.class)); assertThat(ordering.operand(), is(instanceOf(NodeName.class))); assertThat(ordering.order(), is(Order.DESCENDING)); }
@Test public void shouldParseOrderingFromDynamicOperandAndDefaultToAscendingWhenNotFollowedByAscendingOrDescendingKeyword() { Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) OTHER"), typeSystem, mock(Source.class)); assertThat(ordering.operand(), is(instanceOf(NodeName.class))); assertThat(ordering.order(), is(Order.ASCENDING)); }