mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Improved execution of grouped assertions
Signed-off-by: Elvys Soares <eas5@cin.ufpe.br>
This commit is contained in:
parent
14070f0305
commit
6dd845a365
1 changed files with 12 additions and 20 deletions
|
@ -94,12 +94,10 @@ class ClinicServiceTests {
|
|||
@Test
|
||||
void shouldFindSingleOwnerWithPet() {
|
||||
Owner owner = this.owners.findById(1);
|
||||
assertAll(
|
||||
() -> assertThat(owner.getLastName()).startsWith("Franklin"),
|
||||
() -> assertThat(owner.getPets()).hasSize(1),
|
||||
() -> assertThat(owner.getPets().get(0).getType()).isNotNull(),
|
||||
() -> assertThat(owner.getPets().get(0).getType().getName()).isEqualTo("cat")
|
||||
);
|
||||
assertAll(() -> assertThat(owner.getLastName()).startsWith("Franklin"),
|
||||
() -> assertThat(owner.getPets()).hasSize(1),
|
||||
() -> assertThat(owner.getPets().get(0).getType()).isNotNull(),
|
||||
() -> assertThat(owner.getPets().get(0).getType().getName()).isEqualTo("cat"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -139,10 +137,8 @@ class ClinicServiceTests {
|
|||
@Test
|
||||
void shouldFindPetWithCorrectId() {
|
||||
Pet pet7 = this.pets.findById(7);
|
||||
assertAll(
|
||||
() -> assertThat(pet7.getName()).startsWith("Samantha"),
|
||||
() -> assertThat(pet7.getOwner().getFirstName()).isEqualTo("Jean")
|
||||
);
|
||||
assertAll(() -> assertThat(pet7.getName()).startsWith("Samantha"),
|
||||
() -> assertThat(pet7.getOwner().getFirstName()).isEqualTo("Jean"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -196,12 +192,10 @@ class ClinicServiceTests {
|
|||
void shouldFindVets() {
|
||||
Collection<Vet> vets = this.vets.findAll();
|
||||
Vet vet = EntityUtils.getById(vets, Vet.class, 3);
|
||||
assertAll(
|
||||
() -> assertThat(vet.getLastName()).isEqualTo("Douglas"),
|
||||
() -> assertThat(vet.getNrOfSpecialties()).isEqualTo(2),
|
||||
() -> assertThat(vet.getSpecialties().get(0).getName()).isEqualTo("dentistry"),
|
||||
() -> assertThat(vet.getSpecialties().get(1).getName()).isEqualTo("surgery")
|
||||
);
|
||||
assertAll(() -> assertThat(vet.getLastName()).isEqualTo("Douglas"),
|
||||
() -> assertThat(vet.getNrOfSpecialties()).isEqualTo(2),
|
||||
() -> assertThat(vet.getSpecialties().get(0).getName()).isEqualTo("dentistry"),
|
||||
() -> assertThat(vet.getSpecialties().get(1).getName()).isEqualTo("surgery"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -225,10 +219,8 @@ class ClinicServiceTests {
|
|||
Collection<Visit> visits = this.visits.findByPetId(7);
|
||||
assertThat(visits).hasSize(2);
|
||||
Visit[] visitArr = visits.toArray(new Visit[visits.size()]);
|
||||
assertAll(
|
||||
() -> assertThat(visitArr[0].getDate()).isNotNull(),
|
||||
() -> assertThat(visitArr[0].getPetId()).isEqualTo(7)
|
||||
);
|
||||
assertAll(() -> assertThat(visitArr[0].getDate()).isNotNull(),
|
||||
() -> assertThat(visitArr[0].getPetId()).isEqualTo(7));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue