mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-01-12 13:01:10 +00:00
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:
parent
817fabd9ea
commit
ca755be44a
5 changed files with 40 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue