### Question:
SchematronCriteriaSpecs { public static Specification<SchematronCriteria> hasGroupName(final String name) { return new Specification<SchematronCriteria>() { @Override public Predicate toPredicate(Root<SchematronCriteria> root, CriteriaQuery<?> query, CriteriaBuilder cb) { final Path<String> groupNamePath = root.get(SchematronCriteria_.group).get(SchematronCriteriaGroup_.id).get (SchematronCriteriaGroupId_.name); return cb.equal(groupNamePath, name); } }; }  static Specification<SchematronCriteria> hasSchematronId(final int schematronId); static Specification<SchematronCriteria> hasGroupName(final String name);  }### Answer:
@Test public void testHasGroupName() throws Exception { SchematronCriteriaGroup group1 = newGroup(_inc, _schematronRepository); group1 = _criteriaGroupRepository.saveAndFlush(group1); SchematronCriteriaGroup group2 = newGroup(_inc, _schematronRepository); group2 = _criteriaGroupRepository.saveAndFlush(group2); SchematronCriteriaGroup group3 = newGroup(_inc, _schematronRepository); group3.getId().setName(group1.getId().getName()); group3 = _criteriaGroupRepository.saveAndFlush(group3); final List<SchematronCriteria> found = _criteriaRepository.findAll(SchematronCriteriaSpecs.hasGroupName(group1.getId().getName())); assertCorrectCriteriaFound(group1, group2, group3, found); }