mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 20:35:49 +00:00
test: rewrite assertions using AssertJ better readability
This commit is contained in:
parent
4f78b07490
commit
9ed20bf999
1 changed files with 5 additions and 5 deletions
|
@ -112,7 +112,7 @@ class ClinicServiceTests {
|
||||||
owner.setCity("Wollongong");
|
owner.setCity("Wollongong");
|
||||||
owner.setTelephone("4444444444");
|
owner.setTelephone("4444444444");
|
||||||
this.owners.save(owner);
|
this.owners.save(owner);
|
||||||
assertThat(owner.getId().longValue()).isNotEqualTo(0);
|
assertThat(owner.getId().longValue()).isNotZero();
|
||||||
|
|
||||||
owners = this.owners.findByLastName("Schultz", pageable);
|
owners = this.owners.findByLastName("Schultz", pageable);
|
||||||
assertThat(owners.getTotalElements()).isEqualTo(found + 1);
|
assertThat(owners.getTotalElements()).isEqualTo(found + 1);
|
||||||
|
@ -155,12 +155,12 @@ class ClinicServiceTests {
|
||||||
pet.setType(EntityUtils.getById(types, PetType.class, 2));
|
pet.setType(EntityUtils.getById(types, PetType.class, 2));
|
||||||
pet.setBirthDate(LocalDate.now());
|
pet.setBirthDate(LocalDate.now());
|
||||||
owner6.addPet(pet);
|
owner6.addPet(pet);
|
||||||
assertThat(owner6.getPets().size()).isEqualTo(found + 1);
|
assertThat(owner6.getPets()).hasSize(found + 1);
|
||||||
|
|
||||||
this.owners.save(owner6);
|
this.owners.save(owner6);
|
||||||
|
|
||||||
owner6 = this.owners.findById(6);
|
owner6 = this.owners.findById(6);
|
||||||
assertThat(owner6.getPets().size()).isEqualTo(found + 1);
|
assertThat(owner6.getPets()).hasSize(found + 1);
|
||||||
// checks that id has been generated
|
// checks that id has been generated
|
||||||
pet = owner6.getPet("bowser");
|
pet = owner6.getPet("bowser");
|
||||||
assertThat(pet.getId()).isNotNull();
|
assertThat(pet.getId()).isNotNull();
|
||||||
|
@ -168,7 +168,7 @@ class ClinicServiceTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Transactional
|
@Transactional
|
||||||
void shouldUpdatePetName() throws Exception {
|
void shouldUpdatePetName() {
|
||||||
Owner owner6 = this.owners.findById(6);
|
Owner owner6 = this.owners.findById(6);
|
||||||
Pet pet7 = owner6.getPet(7);
|
Pet pet7 = owner6.getPet(7);
|
||||||
String oldName = pet7.getName();
|
String oldName = pet7.getName();
|
||||||
|
@ -213,7 +213,7 @@ class ClinicServiceTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldFindVisitsByPetId() throws Exception {
|
void shouldFindVisitsByPetId() {
|
||||||
Owner owner6 = this.owners.findById(6);
|
Owner owner6 = this.owners.findById(6);
|
||||||
Pet pet7 = owner6.getPet(7);
|
Pet pet7 = owner6.getPet(7);
|
||||||
Collection<Visit> visits = pet7.getVisits();
|
Collection<Visit> visits = pet7.getVisits();
|
||||||
|
|
Loading…
Reference in a new issue