BAEL-1304 changes after code review

This commit is contained in:
abialas 2017-12-15 23:43:51 +01:00
parent b1323faaf3
commit 970de81734
2 changed files with 20 additions and 27 deletions

View File

@ -72,6 +72,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.version}</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -26,19 +26,13 @@ public class PersonsRepositoryTest {
private PersonsRepository personsRepository; private PersonsRepository personsRepository;
@Test @Test
public void shouldAddOnePersonToDB() { public void givenPerson_whenSave_thenAddOnePersonToDB() {
// when
personsRepository.save(new Person()); personsRepository.save(new Person());
assertThat(personsRepository.findAll().spliterator().getExactSizeIfKnown(), equalTo(1l));
// then
assertThat(personsRepository.findAll()
.spliterator()
.getExactSizeIfKnown(), equalTo(1l));
} }
@Test @Test
public void shouldFindOnePersonWithNameAdam() { public void givenPersonsAdamAndDaveInDB_whenSearchForPersonWithNameAdam_thenFindOnePerson() {
// given
Person person1 = new Person(); Person person1 = new Person();
person1.setFirstName("Adam"); person1.setFirstName("Adam");
@ -48,10 +42,8 @@ public class PersonsRepositoryTest {
personsRepository.save(person1); personsRepository.save(person1);
personsRepository.save(person2); personsRepository.save(person2);
// when
Person foundPerson = personsRepository.findByFirstName("Adam"); Person foundPerson = personsRepository.findByFirstName("Adam");
// then
assertThat(foundPerson.getFirstName(), equalTo("Adam")); assertThat(foundPerson.getFirstName(), equalTo("Adam"));
assertThat(foundPerson.getId(), notNullValue()); assertThat(foundPerson.getId(), notNullValue());
} }