Refine PropertyReferenceException message.

Use single-quotes to indicate which elements belong to the underlying type and which are part of the textual message.

Closes #2395
This commit is contained in:
Mark Paluch
2022-01-25 14:33:04 +01:00
parent da64183e61
commit ce9fcf9eb7
3 changed files with 11 additions and 11 deletions

View File

@@ -187,28 +187,28 @@ class PropertyPathUnitTests {
assertThat(iterator.hasNext()).isFalse();
}
@Test // DATACMNS-139
@Test // DATACMNS-139, GH-2395
void rejectsInvalidPropertyWithLeadingUnderscore() {
assertThatExceptionOfType(PropertyReferenceException.class)//
.isThrownBy(() -> PropertyPath.from("_id", Foo.class))//
.withMessageContaining("property _id");
.withMessageContaining("property '_id'");
}
@Test // DATACMNS-139
@Test // DATACMNS-139, GH-2395
void rejectsNestedInvalidPropertyWithLeadingUnderscore() {
assertThatExceptionOfType(PropertyReferenceException.class)//
.isThrownBy(() -> PropertyPath.from("_foo_id", Sample2.class))//
.withMessageContaining("property id");
.withMessageContaining("property 'id'");
}
@Test // DATACMNS-139
@Test // DATACMNS-139, GH-2395
void rejectsNestedInvalidPropertyExplictlySplitWithLeadingUnderscore() {
assertThatExceptionOfType(PropertyReferenceException.class)//
.isThrownBy(() -> PropertyPath.from("_foo__id", Sample2.class))//
.withMessageContaining("property _id");
.withMessageContaining("property '_id'");
}
@Test // DATACMNS 158

View File

@@ -452,7 +452,7 @@ class RepositoryFactorySupportUnitTests {
.hasMessageContaining("does not support Reactive Query by Example");
}
@Test // GH-2341
@Test // GH-2341, GH-2395
void derivedQueryMethodCannotBeImplemented() {
var factory = new DummyRepositoryFactory(backingRepo) {
@@ -468,7 +468,7 @@ class RepositoryFactorySupportUnitTests {
assertThatThrownBy(() -> factory.getRepository(WithQueryMethodUsingInvalidProperty.class))
.isInstanceOf(QueryCreationException.class).hasMessageContaining("findAllByName")
.hasMessageContaining("No property name found for type Object");
.hasMessageContaining("No property 'name' found for type 'Object'");
}
private ConvertingRepository prepareConvertingRepository(final Object expectedValue) {