HibernateQueryTranslator extends
        AbstractHibernateQueryTranslator<Criterion, Orders, Projection> implements QueryTranslator<Criterion, Orders, Projection> { @Override public Orders order(String fieldName, Ordering.Order o) { return new Orders(Ordering.Order.ASCENDING.equals(o) ? Order.asc(fieldName) : Order.desc(fieldName)); } HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker,
            ContainsExpressionHandler<Criterion> containsExpressionHandler);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver,
            BoxMaker boxMaker);  HibernateQueryTranslator(HibernatePropertyResolver propertyResolver); @Override Criterion eq(String fieldName, Object value); @Override Criterion ne(String fieldName, Object value); @Override Criterion lt(String fieldName, Object value); @Override Criterion lte(String fieldName, Object value); @Override Criterion gt(String fieldName, Object value); @Override Criterion gte(String fieldName, Object value); @Override Criterion between(String fieldName, Object from, Object to); @Override Criterion in(String fieldName, Object[] values); @Override Criterion notIn(String fieldName, Object[] values); @Override Criterion isNull(String fieldName); @Override Criterion notNull(String fieldName); @Override Criterion isEmpty(String fieldName); @Override Criterion notEmpty(String fieldName); @Override Criterion within(
            String xFieldName, String yFieldName, Box<N> box); @Override Criterion and(Criterion... subqueries); @Override Criterion or(Criterion... subqueries); @Override Orders order(String fieldName, Ordering.Order o); @Override Orders order(Orders... orders); @Override Projection translateProjection(Query<T, R> query);  }
@Test public void ordering_asc() { assertEquivalent(Order.asc(property), translator.order(property, Ordering.Order.ASCENDING).get().get(0)); }
@Test public void ordering_desc() { assertEquivalent(Order.desc(property), translator.order(property, Ordering.Order.DESCENDING).get().get(0)); }
@Test public void translateOrdering_many() { Order o1 = Order.asc("property1"); Order o2 = Order.desc("property2"); Order o3 = Order.asc("property3"); Order o4 = Order.desc("property4"); Order[] orders = new Order[] { o1, o2, o3, o4 }; Orders l1 = new Orders(o1); Orders l2 = new Orders(o2); Orders l3 = new Orders(o3); Orders l4 = new Orders(o4); Orders merged = translator.order(l1, l2, l3, l4); for (int i = 1; i < orders.length; i++) { assertEquivalent(orders[i], merged.get().get(i)); } }