diff --git a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java index d7240f3..84c23b1 100644 --- a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java +++ b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java @@ -112,7 +112,7 @@ class ClinicServiceTests { owner.setCity("Wollongong"); owner.setTelephone("4444444444"); this.owners.save(owner); - assertThat(owner.getId().longValue()).isNotEqualTo(0); + assertThat(owner.getId().longValue()).isNotZero(); owners = this.owners.findByLastName("Schultz", pageable); assertThat(owners.getTotalElements()).isEqualTo(found + 1); @@ -155,12 +155,12 @@ class ClinicServiceTests { pet.setType(EntityUtils.getById(types, PetType.class, 2)); pet.setBirthDate(LocalDate.now()); owner6.addPet(pet); - assertThat(owner6.getPets().size()).isEqualTo(found + 1); + assertThat(owner6.getPets()).hasSize(found + 1); this.owners.save(owner6); owner6 = this.owners.findById(6); - assertThat(owner6.getPets().size()).isEqualTo(found + 1); + assertThat(owner6.getPets()).hasSize(found + 1); // checks that id has been generated pet = owner6.getPet("bowser"); assertThat(pet.getId()).isNotNull(); @@ -168,7 +168,7 @@ class ClinicServiceTests { @Test @Transactional - void shouldUpdatePetName() throws Exception { + void shouldUpdatePetName() { Owner owner6 = this.owners.findById(6); Pet pet7 = owner6.getPet(7); String oldName = pet7.getName(); @@ -213,7 +213,7 @@ class ClinicServiceTests { } @Test - void shouldFindVisitsByPetId() throws Exception { + void shouldFindVisitsByPetId() { Owner owner6 = this.owners.findById(6); Pet pet7 = owner6.getPet(7); Collection visits = pet7.getVisits();