@Test public void testUnique(){ String email = "unique@foo.com"; User a = getAValidUser(); a.setEmail(email); assertTrue(persistInATransaction(a)); User b = getAValidUser(); b.setEmail(email+".uk"); assertTrue(persistInATransaction(b)); User c = getAValidUser(); c.setEmail(email); assertFalse(persistInATransaction(c)); }
public void setEmail(String email) { this.email = email; }
User { public void setEmail(String email) { this.email = email; } }
User { public void setEmail(String email) { this.email = email; } User(); }
User { public void setEmail(String email) { this.email = email; } User(); Long getId(); void setId(Long id); String getName(); void setName(String name); String getMiddleName(); void setMiddleName(String middleName); String getSurname(); void setSurname(String surname); LocalDate getDateOfRegistration(); void setDateOfRegistration(LocalDate dateOfRegistration); LocalDate getDateOfBirth(); void setDateOfBirth(LocalDate dateOfBirth); String getEmail(); void setEmail(String email); }
User { public void setEmail(String email) { this.email = email; } User(); Long getId(); void setId(Long id); String getName(); void setName(String name); String getMiddleName(); void setMiddleName(String middleName); String getSurname(); void setSurname(String surname); LocalDate getDateOfRegistration(); void setDateOfRegistration(LocalDate dateOfRegistration); LocalDate getDateOfBirth(); void setDateOfBirth(LocalDate dateOfBirth); String getEmail(); void setEmail(String email);  }