use of org.springframework.data.mapping.context.SamplePersistentProperty in project spring-data-commons by spring-projects.
the class PersistentEntityInformationUnitTests method returnsNullIfNoIdPropertyPresent.
// DATACMNS-596
@Test
public void returnsNullIfNoIdPropertyPresent() {
SampleMappingContext context = new SampleMappingContext();
PersistentEntity<Object, SamplePersistentProperty> entity = context.getRequiredPersistentEntity(EntityWithoutId.class);
PersistentEntityInformation<Object, Serializable> information = new PersistentEntityInformation<>(entity);
assertThat(information.getId(new EntityWithoutId())).isNull();
}
use of org.springframework.data.mapping.context.SamplePersistentProperty in project spring-data-commons by spring-projects.
the class MappingContextTypeInformationMapperUnitTests method detectsTypeForUnknownEntity.
@Test
public void detectsTypeForUnknownEntity() {
SampleMappingContext mappingContext = new SampleMappingContext();
mappingContext.initialize();
mapper = new MappingContextTypeInformationMapper(mappingContext);
assertThat(mapper.resolveTypeFrom(Alias.of("foo"))).isNull();
PersistentEntity<?, SamplePersistentProperty> entity = mappingContext.getRequiredPersistentEntity(Entity.class);
assertThat(entity).isNotNull();
assertThat(mapper.resolveTypeFrom(Alias.of("foo"))).isEqualTo(from(Entity.class));
}
Aggregations