Simplify AssertJ assertions and also make them more readable
See gh-33653
This commit is contained in:
committed by
Moritz Halbritter
parent
c9a2b2ab66
commit
cf6493f65c
@@ -53,7 +53,7 @@ class OverrideAutoConfigurationContextCustomizerFactoryTests {
|
||||
void hashCodeAndEquals() {
|
||||
ContextCustomizer customizer1 = this.factory.createContextCustomizer(WithAnnotationEnabledFalse.class, null);
|
||||
ContextCustomizer customizer2 = this.factory.createContextCustomizer(WithSameAnnotation.class, null);
|
||||
assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode());
|
||||
assertThat(customizer1).hasSameHashCodeAs(customizer2);
|
||||
assertThat(customizer1).isEqualTo(customizer1).isEqualTo(customizer2);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class DataLdapTestIntegrationTests {
|
||||
void testRepository() {
|
||||
LdapQuery ldapQuery = LdapQueryBuilder.query().where("cn").is("Bob Smith");
|
||||
Optional<ExampleEntry> entry = this.exampleRepository.findOne(ldapQuery);
|
||||
assertThat(entry.isPresent()).isTrue();
|
||||
assertThat(entry).isPresent();
|
||||
assertThat(entry.get().getDn())
|
||||
.isEqualTo(LdapUtils.newLdapName("cn=Bob Smith,ou=company1,c=Sweden,dc=spring,dc=org"));
|
||||
assertThat(this.ldapTemplate.findOne(ldapQuery, ExampleEntry.class).getDn())
|
||||
|
||||
@@ -69,7 +69,7 @@ class DataNeo4jTestIntegrationTests {
|
||||
assertThat(exampleGraph.getId()).isNull();
|
||||
ExampleGraph savedGraph = this.exampleRepository.save(exampleGraph);
|
||||
assertThat(savedGraph.getId()).isNotNull();
|
||||
assertThat(this.neo4jTemplate.count(ExampleGraph.class)).isEqualTo(1);
|
||||
assertThat(this.neo4jTemplate.count(ExampleGraph.class)).isOne();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -68,7 +68,7 @@ class TypeExcludeFiltersContextCustomizerFactoryTests {
|
||||
ContextCustomizer customizer1 = this.factory.createContextCustomizer(WithExcludeFilters.class, null);
|
||||
ContextCustomizer customizer2 = this.factory.createContextCustomizer(WithSameExcludeFilters.class, null);
|
||||
ContextCustomizer customizer3 = this.factory.createContextCustomizer(WithDifferentExcludeFilters.class, null);
|
||||
assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode());
|
||||
assertThat(customizer1).hasSameHashCodeAs(customizer2);
|
||||
assertThat(customizer1).isEqualTo(customizer1).isEqualTo(customizer2).isNotEqualTo(customizer3);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class JdbcTestIntegrationTests {
|
||||
Collection<ExampleEntity> entities = repository.findAll();
|
||||
assertThat(entities).hasSize(1);
|
||||
ExampleEntity entity = entities.iterator().next();
|
||||
assertThat(entity.getId()).isEqualTo(1);
|
||||
assertThat(entity.getId()).isOne();
|
||||
assertThat(entity.getName()).isEqualTo("John");
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class PropertyMappingContextCustomizerFactoryTests {
|
||||
ContextCustomizer customizer1 = this.factory.createContextCustomizer(TypeMapping.class, null);
|
||||
ContextCustomizer customizer2 = this.factory.createContextCustomizer(AttributeMapping.class, null);
|
||||
ContextCustomizer customizer3 = this.factory.createContextCustomizer(OtherMapping.class, null);
|
||||
assertThat(customizer1.hashCode()).isEqualTo(customizer2.hashCode());
|
||||
assertThat(customizer1).hasSameHashCodeAs(customizer2);
|
||||
assertThat(customizer1).isEqualTo(customizer1).isEqualTo(customizer2).isNotEqualTo(customizer3);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user