@Autowired
private ConsulAdresseGenerator consulAdresseGenerator;
@Test
public void identityShouldBePreserved() {
ConsulAdresse consulAdresse = consulAdresseGenerator.getConsulAdresse();
// add it to a Set before saving (force equals/hashcode)
Sets.newHashSet(consulAdresse);
consulAdresseRepository.save(consulAdresse);
entityManager.flush();
// reload it from cache and check equality
Integer id = consulAdresse.getId();
assertThat(consulAdresse).isEqualTo(consulAdresseRepository.findOne(id));
// clear cache to force reload from db
entityManager.clear();