DATACMNS-1208 - AbstractMappingContext.hasPersistentEntityFor(…) now properly considers cached absence.
AbstractMappingContext.hasPersistentEntityFor(…) now also properly consideres the empty Optional as non-presence as that is held to allow to distinguish between a type completely unkown to the context, or already known but not considered a persistent entity. Related pull request: #258.
This commit is contained in:
@@ -244,6 +244,16 @@ public class AbstractMappingContextUnitTests {
|
||||
.isSameAs(context.getPersistentPropertyPath("persons.name", Sample.class));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1208
|
||||
public void ensureHasPersistentEntityReportsFalseForTypesThatShouldntBeCreated() {
|
||||
|
||||
SampleMappingContext context = new SampleMappingContext();
|
||||
|
||||
assertThat(context.hasPersistentEntityFor(String.class)).isFalse();
|
||||
assertThat(context.getPersistentEntity(String.class)).isNull();
|
||||
assertThat(context.hasPersistentEntityFor(String.class)).isFalse();
|
||||
}
|
||||
|
||||
private static void assertHasEntityFor(Class<?> type, SampleMappingContext context, boolean expected) {
|
||||
|
||||
boolean found = false;
|
||||
|
||||
Reference in New Issue
Block a user