CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Person> personQuery = criteriaBuilder.createQuery(Person.class);
Root<Person> from = personQuery.from(Person.class);
personQuery.select(from.alias("p"));
personQuery.where(criteriaBuilder.and(criteriaBuilder.equal(from.get("personName"), "vivek"),
criteriaBuilder.gt((Expression)from.get("age"), 32),criteriaBuilder.le((Expression)from.get("salary"), 3200.01)));
personQuery.orderBy(criteriaBuilder.desc(from.get("personName")));
String actual = CriteriaQueryTranslator.translate(personQuery);
Assert.assertEquals(expected.trim(), actual.trim());
}