Skip to content

Commit

Permalink
test: rewrite assertions using AssertJ better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
anyulled authored and dsyer committed May 16, 2024
1 parent 4f78b07 commit 9ed20bf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void shouldInsertOwner() {
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);
Expand Down Expand Up @@ -155,20 +155,20 @@ void shouldInsertPetIntoDatabaseAndGenerateId() {
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();
}

@Test
@Transactional
void shouldUpdatePetName() throws Exception {
void shouldUpdatePetName() {
Owner owner6 = this.owners.findById(6);
Pet pet7 = owner6.getPet(7);
String oldName = pet7.getName();
Expand Down Expand Up @@ -213,7 +213,7 @@ void shouldAddNewVisitForPet() {
}

@Test
void shouldFindVisitsByPetId() throws Exception {
void shouldFindVisitsByPetId() {
Owner owner6 = this.owners.findById(6);
Pet pet7 = owner6.getPet(7);
Collection<Visit> visits = pet7.getVisits();
Expand Down

0 comments on commit 9ed20bf

Please sign in to comment.