mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:25:49 +00:00
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:
parent
1c0139a39c
commit
2b57c51d41
2 changed files with 3 additions and 3 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue