### Question:
Person { public void setEmail(String email) { this.email = email; }  String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email);  }### Answer:
@Test public void givenBeanWithValidEmailConstraints_shouldValidate() { Person person = new Person(); person.setEmail("alex.theedom@example.com"); Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person); assertThat(constraintViolations.size()).isEqualTo(0); }
@Test public void givenBeanWithInvalidEmailConstraints_shouldNotValidate() { Person person = new Person(); person.setEmail("alex.theedom@example"); Set<ConstraintViolation<Person>> constraintViolations = validator.validate(person); assertThat(constraintViolations.size()).isEqualTo(0); }