@Test(expected = ValidationException.class) public void shouldCheckValidCharacters_InEmail() { Person person = new Person(); person.setEmail("foo@bar"); person.setName("Ff hhh"); person = personRespository.save(person); }
@Test(expected = ValidationException.class) public void shouldCheckNameLength() { Person person = new Person(); person.setEmail("*****@*****.**"); person.setName("f"); person = personRespository.save(person); }
@Test(expected = ValidationException.class) public void shouldCheckEmptyEmail() { Person person = new Person(); person.setName("foo bar"); person = personRespository.save(person); }
@Test public void shouldSavePerson() { Person person = new Person(); person.setName("Foo Bar"); person.setEmail("*****@*****.**"); person.setGender(new Gender(Value.MALE)); person = personRespository.save(person); Person expectedPerson = personRespository.getPersonById(person.getId()); assertEquals(expectedPerson.getName(), person.getName()); assertEquals(expectedPerson.getGender(), person.getGender()); assertEquals(expectedPerson.getEmail(), person.getEmail()); }