@Autowired
private HarvesterDataRepository _dataRepository;
@Test
public void testFindAllById_HarvesterUuid() throws Exception {
final HarvesterData data1 = newHarvesterData(_inc);
_dataRepository.save(data1);
final HarvesterData data2 = newHarvesterData(_inc);
_dataRepository.save(data2);
final HarvesterData data3 = newHarvesterData(_inc);
data3.getId().setHarvesterUuid(data1.getId().getHarvesterUuid());
_dataRepository.save(data3);
List<HarvesterData> found = _dataRepository.findAllById_HarvesterUuid(data1.getId().getHarvesterUuid());
assertEquals(2, found.size());
for (HarvesterData harvesterData : found) {
assertEquals(data1.getId().getHarvesterUuid(), harvesterData.getId().getHarvesterUuid());
if (harvesterData.getId().getKey().equals(data2.getId().getKey())) {
fail("should not have found data2: "+data2);
} else {
final boolean equalsData1 = data1.equals(harvesterData);
final boolean equalsData3 = data3.equals(harvesterData);
assertTrue("Expected "+harvesterData+" to equals: "+data1+" or "+data3, equalsData1 || equalsData3);
}
}
}