Improvements in VisitRepository.findByPetId implementation.

- In the Jdbc implementation: pets belonging to a visit were not added.
- In the Jpa implementation: query variable was wrong.
- Test case: AbstractClinicServiceTests.shouldFindVisitsByPetId()
This commit is contained in:
Attilio 2016-06-15 22:46:47 +02:00
parent 817fabd9ea
commit ca755be44a
5 changed files with 40 additions and 6 deletions

View file

@ -190,5 +190,15 @@ public abstract class AbstractClinicServiceTests {
assertThat(visit.getId()).isNotNull();
}
@Test
public void shouldFindVisitsByPetId() throws Exception {
Collection<Visit> visits = this.clinicService.findVisitsByPetId(7);
assertThat(visits.size()).isEqualTo(2);
Visit[] visitArr = visits.toArray(new Visit[visits.size()]);
assertThat(visitArr[0].getPet()).isNotNull();
assertThat(visitArr[0].getDate()).isNotNull();
assertThat(visitArr[0].getPet().getId()).isEqualTo(7);
}
}