TypedQueryBuilder { public <S extends T>TypedQuery<S> getTypedQuery(Class<S> domainClass, Sort sort){ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<S> criteriaQuery = criteriaBuilder.createQuery(domainClass); Root<S> root = applyPredicates(domainClass, criteriaQuery); criteriaQuery.select(root); if(sort.isSorted()) { criteriaQuery.orderBy(toOrders(sort, root, criteriaBuilder)); } return entityManager.createQuery(criteriaQuery); } TypedQueryBuilder(OpaCompilerResponse opaCompilerResponse, EntityManager entityManager); TypedQuery<S> getTypedQuery(Class<S> domainClass, Sort sort);  }
@Test void shouldReturnCriteria() { TypedQuery<PetEntity> result = target.getTypedQuery(PetEntity.class, Sort.unsorted()); assertThat(result, is(notNullValue())); }