for (Order order : Order.values()) {
for (Iterable<? extends Element> iter : ImmutableList.of(
tx.query().has("text", Text.CONTAINS, words[i]).orderBy(orderKey, order).vertices(),
tx.query().has("text", Text.CONTAINS, words[i]).orderBy(orderKey, order).edges()
)) {
Element previous = null;
int count = 0;
for (Element element : iter) {
if (previous != null) {
int cmp = ((Comparable) element.getProperty(orderKey)).compareTo(previous.getProperty(orderKey));
assertTrue(element.getProperty(orderKey) + " <> " + previous.getProperty(orderKey),
order == Order.ASC ? cmp >= 0 : cmp <= 0);
}
previous = element;
count++;
}