Skip to content

Commit 870743e

Browse files
committed
Polishing.
Update assertions to verify root cause of MappingException. See #5053
1 parent f0353ed commit 870743e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MongoMappingContextUnitTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void rejectsClassWithAmbiguousFieldMappings() {
9696
context.setApplicationContext(applicationContext);
9797

9898
assertThatExceptionOfType(MappingException.class).isThrownBy(() -> context.getPersistentEntity(InvalidPerson.class))
99+
.havingRootCause()
99100
.withMessageContaining("firstname").withMessageContaining("lastname").withMessageContaining("foo")
100101
.withMessageContaining("@Field");
101102
}
@@ -158,7 +159,7 @@ void shouldRejectClassWithInvalidTextScoreProperty() {
158159
MongoMappingContext context = new MongoMappingContext();
159160

160161
assertThatExceptionOfType(MappingException.class)
161-
.isThrownBy(() -> context.getPersistentEntity(ClassWithInvalidTextScoreProperty.class))
162+
.isThrownBy(() -> context.getPersistentEntity(ClassWithInvalidTextScoreProperty.class)).havingRootCause()
162163
.withMessageContaining("score").withMessageContaining("Float").withMessageContaining("Double");
163164
}
164165

0 commit comments

Comments
 (0)