AbstractQueryTranslator implements QueryTranslator<Q,O,P> { @Override public <T,R> Q translate(Query<T,R> query) { Criterion rootCriterion = query.getCriteria(); Class<T> entityClass = query.getEntityClass(); return translate(rootCriterion, entityClass); } AbstractQueryTranslator(Class<Q> queryClass,
            Class<O> orderClass,
            PropertyResolver propertyResolver); @Override Q translate(Query<T,R> query); @Override O translateOrder(Query<T, R> query); abstract Q eq(String fieldName, Object value); abstract Q ne(String fieldName, Object value); abstract Q lt(String fieldName, Object value); abstract Q lte(String fieldName, Object value); abstract Q gt(String fieldName, Object value); abstract Q gte(String fieldName, Object value); abstract Q between(String fieldName, Object from, Object to); abstract Q in(String fieldName, Object[] values); abstract Q notIn(String fieldName, Object[] values); abstract Q contains(String fieldName, Object[] values); abstract Q isNull(String fieldName); abstract Q notNull(String fieldName); abstract Q isEmpty(String fieldName); abstract Q notEmpty(String fieldName); abstract Q within(
            String fieldName, Point<N> center, Number distance); abstract Q and(Q... subqueries); abstract Q or(Q... subqueries); abstract O order(String fieldName, Order o); abstract O order(O... orders);  }
@Test public void translate_Conjunction() { Conjunction j = new Conjunction(); String expected = verify_translate_Junction(j, " and "); assertEquals(expected, translator.translate(j, entityClass)); }
@Test public void translate_Disjunction() { Disjunction j = new Disjunction(); String expected = verify_translate_Junction(j, " or "); assertEquals(expected, translator.translate(j, entityClass)); }
@Test public void translate_NativeExpression() { String expression = "property & 4 > 0"; NativeExpression e = new NativeExpression(String.class, expression); assertEquals(expression, translator.translate(query(e))); assertEquals(expression, translator.translate(e, entityClass)); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_Junction() { translator.translate(new Junction(Operator.EQUAL){}, entityClass); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_Criterion() { translator.translate(new Criterion(){}, entityClass); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_Expression() { translator.translate(new Expression(Operator.EQUAL, field){}, entityClass); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_EqualityExpression() { translator.translate(new EqualityExpression(Operator.BETWEEN, property, testValue), field); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_RangeExpression() { translator.translate(new RangeExpression(Operator.EQUAL, property, testFrom, testTo), field); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_SetExpression() { translator.translate(new SetExpression(Operator.EQUAL, property, testValues), field); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_UnaryExpression() { translator.translate(new UnaryExpression(Operator.EQUAL, property), field); }
@Test(expected = UnsupportedOperationException.class) public void unexpected_Distance2dExpression() { translator.translate(new Distance2dExpression<Double>(Operator.EQUAL, property, x, y, distance), entityClass); }