assertEquals(rating3.getId(), all.get(0).getId());
}
@Test
public void testSaveAndUpdate() {
MetadataRatingByIp rating1 = newMetadataRatingByIp();
rating1 = _repo.save(rating1);
MetadataRatingByIp rating2 = new MetadataRatingByIp();
final int newRating = rating1.getRating() * 100;
rating2.setRating(newRating);
rating2.setId(new MetadataRatingByIpId(rating1.getId().getMetadataId(), rating1.getId().getIpAddress()));
MetadataRatingByIp saved = _repo.save(rating2);
assertEquals(1, _repo.count());
MetadataRatingByIp loaded = _repo.findAll().get(0);
assertEquals(loaded.getRating(), newRating);
assertEquals(rating1.getId(), loaded.getId());
assertEquals(rating2.getId(), loaded.getId());
assertEquals(saved.getId(), loaded.getId());
}