OperationAllowedSpecs { public static Specification<OperationAllowed> hasGroupIdIn(final Collection<Integer> groupIds) { return new Specification<OperationAllowed>() { @Override public Predicate toPredicate(Root<OperationAllowed> root, CriteriaQuery<?> query, CriteriaBuilder cb) { return root.get(OperationAllowed_.id).get(OperationAllowedId_.groupId).in(groupIds); } }; } private  OperationAllowedSpecs(); static Specification<OperationAllowed> hasMetadataId(final String metadataId); static Specification<OperationAllowed> hasMetadataId(final int metadataId); static Specification<OperationAllowed> hasGroupId(final int groupId); static Specification<OperationAllowed> hasOperation(final ReservedOperation operation); static Specification<OperationAllowed> hasOperationId(final int operationId); static Specification<OperationAllowed> isPublic(final ReservedOperation operation); static Specification<OperationAllowed> hasMetadataIdIn(final Collection<Integer> metadataIds); static Specification<OperationAllowed> hasGroupIdIn(final Collection<Integer> groupIds); static Specification<OperationAllowed> hasOperationIdIn(final Collection<Integer> operationIds);  }
@Test public void testHasGroupIdIn() { Specification<OperationAllowed> hasGroupIdIn = OperationAllowedSpecs.hasGroupIdIn(Arrays.asList(_intranetGroup.getId())); List<OperationAllowed> found = _opAllowRepo.findAll(hasGroupIdIn, new Sort(operationIdPath(), metadataIdPath())); assertEquals(found.size(), 3); }