use of org.springframework.data.mapping.context.SampleMappingContext in project spring-data-commons by spring-projects.
the class AnnotationBasedPersistentPropertyUnitTests method setUp.
@Before
public void setUp() {
context = new SampleMappingContext();
entity = context.getRequiredPersistentEntity(Sample.class);
}
use of org.springframework.data.mapping.context.SampleMappingContext in project spring-data-commons by spring-projects.
the class ConvertingPropertyAccessorUnitTests method getIdProperty.
private static SamplePersistentProperty getIdProperty() {
SampleMappingContext mappingContext = new SampleMappingContext();
BasicPersistentEntity<Object, SamplePersistentProperty> entity = mappingContext.getRequiredPersistentEntity(Entity.class);
return entity.getPersistentProperty("id");
}
use of org.springframework.data.mapping.context.SampleMappingContext in project spring-data-commons by spring-projects.
the class BasicPersistentEntityUnitTests method detectsPropertyWithAnnotation.
// DATACMNS-365
@Test
public void detectsPropertyWithAnnotation() {
SampleMappingContext context = new SampleMappingContext();
PersistentEntity<Object, SamplePersistentProperty> entity = context.getRequiredPersistentEntity(Entity.class);
SamplePersistentProperty property = entity.getPersistentProperty(LastModifiedBy.class);
assertThat(property.getName()).isEqualTo("field");
property = entity.getPersistentProperty(CreatedBy.class);
assertThat(property.getName()).isEqualTo("property");
assertThat(entity.getPersistentProperty(CreatedDate.class)).isNull();
}
use of org.springframework.data.mapping.context.SampleMappingContext in project spring-data-commons by spring-projects.
the class BasicPersistentEntityUnitTests method supportsSubtypeInstancesOnPropertyAccessorLookup.
// DATACMNS-597
@Test
public void supportsSubtypeInstancesOnPropertyAccessorLookup() {
SampleMappingContext context = new SampleMappingContext();
PersistentEntity<Object, SamplePersistentProperty> entity = context.getRequiredPersistentEntity(Entity.class);
assertThat(entity.getPropertyAccessor(new Subtype())).isNotNull();
}
use of org.springframework.data.mapping.context.SampleMappingContext in project spring-data-commons by spring-projects.
the class BasicPersistentEntityUnitTests method returnsBeanWrapperForPropertyAccessor.
// DATACMNS-596
@Test
public void returnsBeanWrapperForPropertyAccessor() {
assumeThat(System.getProperty("java.version"), CoreMatchers.startsWith("1.6"));
SampleMappingContext context = new SampleMappingContext();
PersistentEntity<Object, SamplePersistentProperty> entity = context.getRequiredPersistentEntity(Entity.class);
Entity value = new Entity();
PersistentPropertyAccessor accessor = entity.getPropertyAccessor(value);
assertThat(accessor).isInstanceOf(BeanWrapper.class);
assertThat(accessor.getBean()).isEqualTo(value);
}
Aggregations