Simlified assertions using better asset methods

Chained AssertJ assertions should be simplified to the corresponding dedicated assertion [RSPEC-5838](https://rules.sonarsource.com/java/RSPEC-5838)
This commit is contained in:
Abhijay Kumar 2020-08-21 19:43:53 +05:30
parent 1c0139a39c
commit 2b57c51d41
2 changed files with 3 additions and 3 deletions

View file

@ -53,7 +53,7 @@ class ValidatorTests {
assertThat(constraintViolations).hasSize(1);
ConstraintViolation<Person> violation = constraintViolations.iterator().next();
assertThat(violation.getPropertyPath().toString()).isEqualTo("firstName");
assertThat(violation.getPropertyPath()).hasToString("firstName");
assertThat(violation.getMessage()).isEqualTo("must not be empty");
}

View file

@ -112,10 +112,10 @@ 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");
assertThat(owners.size()).isEqualTo(found + 1);
assertThat(owners).hasSize(found + 1);
}
@Test