HarvestHistorySpecs { public static Specification<HarvestHistory> hasHarvesterUuid(final String uuid) { return new Specification<HarvestHistory>() { @Override public Predicate toPredicate(Root<HarvestHistory> root, CriteriaQuery<?> query, CriteriaBuilder cb) { return cb.equal(root.get(HarvestHistory_.harvesterUuid), uuid); } }; } private  HarvestHistorySpecs(); static Specification<HarvestHistory> hasHarvesterUuid(final String uuid);  }
@Test public void testHasHarvesterUuid() throws Exception { HarvestHistory history1 = newHarvestHistory(); history1 = _repo.save(history1); HarvestHistory history2 = newHarvestHistory(); _repo.save(history2); final List<HarvestHistory> found = _repo.findAll(hasHarvesterUuid(history1.getHarvesterUuid())); assertEquals(1, found.size()); assertEquals(history1.getId(), found.get(0).getId()); }