q.addOrdering("paintingArray.estimatedPrice", Ordering.ASC, true);
TstQueryAssembler qa = new TstQueryAssembler(getNode(), q);
try {
TranslationCase tstCase = new TranslationCase(
"Artist",
null,
"UPPER(ta.ARTIST_NAME), UPPER(ta.ESTIMATED_PRICE)");
StringBuilder out = new StringBuilder();
new OrderingTranslator(qa).appendPart(out);
assertTrue(out.length() > 0);
String orderBySql = out.toString();
// Check there is at least one UPPER modifier
int indexOfUpper = orderBySql.indexOf("UPPER(");
assertTrue(indexOfUpper != -1);
// and ensure there is another after it
assertTrue(orderBySql.indexOf("UPPER(", indexOfUpper + 1) != -1);
tstCase.assertTranslatedWell(orderBySql);
}
finally {
qa.dispose();
}
}