use of org.springframework.data.mapping.model.SimpleTypeHolder in project spring-data-commons by spring-projects.
the class SimpleTypeHolderUnitTests method addsDefaultTypes.
@Test
public void addsDefaultTypes() {
SimpleTypeHolder holder = SimpleTypeHolder.DEFAULT;
assertThat(holder.isSimpleType(String.class)).isTrue();
}
use of org.springframework.data.mapping.model.SimpleTypeHolder in project spring-data-commons by spring-projects.
the class SimpleTypeHolderUnitTests method addsCustomTypesToSimpleOnes.
@Test
public void addsCustomTypesToSimpleOnes() {
SimpleTypeHolder holder = new SimpleTypeHolder(Collections.singleton(SimpleTypeHolder.class), true);
assertThat(holder.isSimpleType(SimpleTypeHolder.class)).isTrue();
assertThat(holder.isSimpleType(SimpleTypeHolderUnitTests.class)).isFalse();
}
use of org.springframework.data.mapping.model.SimpleTypeHolder in project spring-data-commons by spring-projects.
the class CustomConversionsUnitTests method registersConverterFactoryCorrectly.
// DATAMONGO-1302, DATACMNS-1035
@Test
void registersConverterFactoryCorrectly() {
StoreConversions conversions = StoreConversions.of(new SimpleTypeHolder(Collections.singleton(Format.class), true));
CustomConversions customConversions = new CustomConversions(conversions, Collections.singletonList(new FormatConverterFactory()));
assertThat(customConversions.getCustomWriteTarget(String.class, SimpleDateFormat.class)).isPresent();
}
use of org.springframework.data.mapping.model.SimpleTypeHolder in project spring-data-commons by spring-projects.
the class AbstractMappingContextUnitTests method detectsEntityTypeEvenIfSimpleTypeHolderConsidersCollectionsSimple.
// GH-2390
@Test
void detectsEntityTypeEvenIfSimpleTypeHolderConsidersCollectionsSimple() {
context.setSimpleTypeHolder(new SimpleTypeHolder(Collections.emptySet(), true) {
@Override
public boolean isSimpleType(Class<?> type) {
return type == String.class || type.getName().startsWith("java.util.");
}
});
context.getPersistentEntity(WithNestedLists.class);
//
assertThat(context.getPersistentEntities()).map(//
it -> (Class) it.getType()).contains(Base.class);
}
use of org.springframework.data.mapping.model.SimpleTypeHolder in project spring-data-commons by spring-projects.
the class AbstractMappingContextUnitTests method setUp.
@BeforeEach
void setUp() {
context = new SampleMappingContext();
context.setSimpleTypeHolder(new SimpleTypeHolder(Collections.singleton(LocalDateTime.class), true));
}
Aggregations