SGF-749 - Rename setGemfireInstantiators(:EntityInstantiators) to setEntityInstantiators(:EntityInstantiators)

Rename setGemfireInstantiators(:Map<Class<?>>, EntityInstantior>) to setEntityInstantiators(:Map<Class<?>, EntityInstantior>).

Rename getGemfireInstantiators() to getEntityInstantiators().

Rename getCustomPdxSerializer(:PersistentProperty) to resolveCustomPdxSerializer(:PersistentProperty).

Rename getInstantiatorFor(:PersistentEntity) to resolveEntityInstantiator(:PersistentEntity).
This commit is contained in:
John Blum
2018-06-09 20:13:17 -07:00
parent 7ca0bc3a17
commit aa4b2a70af
2 changed files with 187 additions and 187 deletions

View File

@@ -309,26 +309,6 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
return Collections.unmodifiableMap(this.customPdxSerializers);
}
/**
* Returns a custom PDX serializer for the given {@link PersistentProperty entity persistent property}.
*
* @param property {@link PersistentProperty} of the entity used to lookup the custom PDX serializer.
* @return a custom {@link PdxSerializer} for the given entity {@link PersistentProperty},
* or {@literal null} if no custom {@link PdxSerializer} could be found.
* @see org.apache.geode.pdx.PdxSerializer
*/
@Nullable
protected PdxSerializer getCustomPdxSerializer(@NonNull PersistentProperty<?> property) {
Map<?, PdxSerializer> customPdxSerializers = getCustomPdxSerializers();
return this.pdxSerializerResolvers.stream()
.map(it -> it.resolve(customPdxSerializers, property))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
/**
* Configures the {@link EntityInstantiator EntityInstantiators} used to create the instances
* read by this {@link PdxSerializer}.
@@ -337,7 +317,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* read by this {@link PdxSerializer}; must not be {@literal null}.
* @see org.springframework.data.convert.EntityInstantiator
*/
public void setGemfireInstantiators(@NonNull EntityInstantiators entityInstantiators) {
public void setEntityInstantiators(@NonNull EntityInstantiators entityInstantiators) {
Assert.notNull(entityInstantiators, "EntityInstantiators must not be null");
@@ -353,8 +333,8 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* @see org.springframework.data.convert.EntityInstantiator
* @see java.util.Map
*/
public void setGemfireInstantiators(@NonNull Map<Class<?>, EntityInstantiator> gemfireInstantiators) {
setGemfireInstantiators(new EntityInstantiators(gemfireInstantiators));
public void setEntityInstantiators(@NonNull Map<Class<?>, EntityInstantiator> gemfireInstantiators) {
setEntityInstantiators(new EntityInstantiators(gemfireInstantiators));
}
/**
@@ -363,23 +343,10 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* @return the configured {@link EntityInstantiators} handling instantiation for Pivotal GemFire persistent entities.
* @see org.springframework.data.convert.EntityInstantiators
*/
protected EntityInstantiators getGemfireInstantiators() {
protected EntityInstantiators getEntityInstantiators() {
return this.entityInstantiators;
}
/**
* Looks up and returns an EntityInstantiator to construct and initialize an instance of the object defined
* by the given PersistentEntity (meta-data).
*
* @param entity the PersistentEntity object used to lookup the custom EntityInstantiator.
* @return an EntityInstantiator for the given PersistentEntity.
* @see org.springframework.data.convert.EntityInstantiator
* @see org.springframework.data.mapping.PersistentEntity
*/
protected EntityInstantiator getInstantiatorFor(PersistentEntity entity) {
return getGemfireInstantiators().getInstantiatorFor(entity);
}
/**
* Returns a reference to the configured {@link Logger} used to log {@link String messages}
* about the functions of this {@link PdxSerializer}.
@@ -510,7 +477,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
GemfirePersistentEntity<?> entity = getPersistentEntity(type);
Object instance = getInstantiatorFor(entity)
Object instance = resolveEntityInstantiator(entity)
.createInstance(entity, new PersistentEntityParameterValueProvider<>(entity,
new GemfirePropertyValueProvider(reader), null));
@@ -521,7 +488,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
if (isWritable(entity, persistentProperty)) {
PdxSerializer customPdxSerializer = getCustomPdxSerializer(persistentProperty);
PdxSerializer customPdxSerializer = resolveCustomPdxSerializer(persistentProperty);
Object value = null;
@@ -606,7 +573,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
if (isReadable(persistentProperty)) {
PdxSerializer customPdxSerializer = getCustomPdxSerializer(persistentProperty);
PdxSerializer customPdxSerializer = resolveCustomPdxSerializer(persistentProperty);
Object propertyValue = null;
@@ -666,6 +633,39 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
return !persistentProperty.isTransient();
}
/**
* Returns a custom PDX serializer for the given {@link PersistentProperty entity persistent property}.
*
* @param property {@link PersistentProperty} of the entity used to lookup the custom PDX serializer.
* @return a custom {@link PdxSerializer} for the given entity {@link PersistentProperty},
* or {@literal null} if no custom {@link PdxSerializer} could be found.
* @see org.apache.geode.pdx.PdxSerializer
*/
@Nullable
protected PdxSerializer resolveCustomPdxSerializer(@NonNull PersistentProperty<?> property) {
Map<?, PdxSerializer> customPdxSerializers = getCustomPdxSerializers();
return this.pdxSerializerResolvers.stream()
.map(it -> it.resolve(customPdxSerializers, property))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
/**
* Looks up and returns an EntityInstantiator to construct and initialize an instance of the object defined
* by the given PersistentEntity (meta-data).
*
* @param entity the PersistentEntity object used to lookup the custom EntityInstantiator.
* @return an EntityInstantiator for the given PersistentEntity.
* @see org.springframework.data.convert.EntityInstantiator
* @see org.springframework.data.mapping.PersistentEntity
*/
protected EntityInstantiator resolveEntityInstantiator(PersistentEntity entity) {
return getEntityInstantiators().getInstantiatorFor(entity);
}
/**
* Resolves the {@link Class type} of the given {@link Object}.
*

View File

@@ -99,7 +99,7 @@ public class MappingPdxSerializerUnitTests {
private ConversionService conversionService;
@Mock
private EntityInstantiator mockInstantiator;
private EntityInstantiator mockEntityInstantiator;
private GemfireMappingContext mappingContext;
@@ -130,7 +130,7 @@ public class MappingPdxSerializerUnitTests {
assertThat(pdxSerializer.getConversionService()).isInstanceOf(DefaultConversionService.class);
assertThat(pdxSerializer.getCustomPdxSerializers()).isEmpty();
assertThat(pdxSerializer.getGemfireInstantiators()).isInstanceOf(EntityInstantiators.class);
assertThat(pdxSerializer.getEntityInstantiators()).isInstanceOf(EntityInstantiators.class);
assertThat(pdxSerializer.getMappingContext()).isInstanceOf(GemfireMappingContext.class);
}
@@ -145,7 +145,7 @@ public class MappingPdxSerializerUnitTests {
assertThat(pdxSerializer.getConversionService()).isEqualTo(mockConversionService);
assertThat(pdxSerializer.getCustomPdxSerializers()).isEmpty();
assertThat(pdxSerializer.getGemfireInstantiators()).isInstanceOf(EntityInstantiators.class);
assertThat(pdxSerializer.getEntityInstantiators()).isInstanceOf(EntityInstantiators.class);
assertThat(pdxSerializer.getMappingContext()).isEqualTo(mockMappingContext);
}
@@ -249,111 +249,20 @@ public class MappingPdxSerializerUnitTests {
}
@Test
@SuppressWarnings("all")
public void getCustomPdxSerializerReturnsNull() {
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
assertThat(this.pdxSerializer.getCustomPdxSerializers()).isEmpty();
assertThat(this.pdxSerializer.getCustomPdxSerializer(addressProperty)).isNull();
}
@Test
@SuppressWarnings("all")
public void getCustomPdxSerializerReturnsPdxSerializerForProperty() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockPropertySerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
this.pdxSerializer.setCustomPdxSerializers(MapBuilder.<Object, PdxSerializer>newMapBuilder()
.put(addressProperty, mockPropertySerializer)
.put(toFullyQualifiedPropertyName(addressProperty), mockNamedSerializer)
.put(Address.class, mockTypedSerializer)
.build());
assertThat(this.pdxSerializer.getCustomPdxSerializer(addressProperty)).isEqualTo(mockPropertySerializer);
}
@Test
@SuppressWarnings("all")
public void getCustomPdxSerializerReturnsPdxSerializerForPropertyName() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
this.pdxSerializer.setCustomPdxSerializers(MapBuilder.<Object, PdxSerializer>newMapBuilder()
.put(toFullyQualifiedPropertyName(addressProperty), mockNamedSerializer)
.put(Address.class, mockTypedSerializer)
.build());
assertThat(this.pdxSerializer.getCustomPdxSerializer(addressProperty)).isEqualTo(mockNamedSerializer);
}
@Test
@SuppressWarnings("all")
public void getCustomPdxSerializerReturnsPdxSerializerForPropertyType() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
Map<Object, PdxSerializer> customPdxSerializers = new HashMap<>();
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
customPdxSerializers.put("example.Type.address", mockNamedSerializer);
customPdxSerializers.put(Address.class, mockTypedSerializer);
this.pdxSerializer.setCustomPdxSerializers(customPdxSerializers);
assertThat(this.pdxSerializer.getCustomPdxSerializer(addressProperty)).isEqualTo(mockTypedSerializer);
}
@Test
public void toFullyQualifiedPropertyName() {
PersistentEntity mockEntity = mock(PersistentEntity.class);
PersistentProperty mockProperty = mock(PersistentProperty.class);
when(mockProperty.getName()).thenReturn("mockProperty");
when(mockProperty.getOwner()).thenReturn(mockEntity);
when(mockEntity.getType()).thenReturn(Person.class);
assertThat(MappingPdxSerializer.PdxSerializerResolvers.toFullyQualifiedPropertyName(mockProperty))
.isEqualTo(Person.class.getName().concat(".mockProperty"));
verify(mockEntity, times(1)).getType();
verify(mockProperty, times(1)).getName();
verify(mockProperty, times(1)).getOwner();
}
@Test
public void setGemfireInstantiatorsWithNonNullEntityInstantiators() {
public void setEntityInstantiatorsWithNonNullEntityInstantiators() {
EntityInstantiators mockEntityInstantiators = mock(EntityInstantiators.class);
this.pdxSerializer.setGemfireInstantiators(mockEntityInstantiators);
this.pdxSerializer.setEntityInstantiators(mockEntityInstantiators);
assertThat(this.pdxSerializer.getGemfireInstantiators()).isSameAs(mockEntityInstantiators);
assertThat(this.pdxSerializer.getEntityInstantiators()).isSameAs(mockEntityInstantiators);
}
@Test(expected = IllegalArgumentException.class)
public void setGemfireInstantiatorsWithNullEntityInstantiators() {
public void setEntityInstantiatorsWithNullEntityInstantiators() {
try {
this.pdxSerializer.setGemfireInstantiators((EntityInstantiators) null);
this.pdxSerializer.setEntityInstantiators((EntityInstantiators) null);
}
catch (IllegalArgumentException expected) {
@@ -365,21 +274,21 @@ public class MappingPdxSerializerUnitTests {
}
@Test
public void setGemfireInstantiatorsWithNonNullMappingOfClassTypesToEntityInstantiators() {
public void setEntityInstantiatorsWithNonNullMappingOfClassTypesToEntityInstantiators() {
Map<Class<?>, EntityInstantiator> entityInstantiators =
Collections.singletonMap(Person.class, mock(EntityInstantiator.class));
this.pdxSerializer.setGemfireInstantiators(entityInstantiators);
this.pdxSerializer.setEntityInstantiators(entityInstantiators);
assertThat(this.pdxSerializer.getGemfireInstantiators()).isInstanceOf(EntityInstantiators.class);
assertThat(this.pdxSerializer.getEntityInstantiators()).isInstanceOf(EntityInstantiators.class);
}
@Test(expected = IllegalArgumentException.class)
public void setGemfireInstantiatorsWithNullMap() {
public void setEntityInstantiatorsWithNullMap() {
try {
this.pdxSerializer.setGemfireInstantiators((Map<Class<?>, EntityInstantiator>) null);
this.pdxSerializer.setEntityInstantiators((Map<Class<?>, EntityInstantiator>) null);
}
catch (IllegalArgumentException expected) {
@@ -390,40 +299,6 @@ public class MappingPdxSerializerUnitTests {
}
}
@Test
public void getInstantiatorForManagedPersistentEntityWithEntityInstantiator() {
EntityInstantiator mockEntityInstantiator = mock(EntityInstantiator.class);
PersistentEntity mockEntity = mock(PersistentEntity.class);
when(mockEntity.getType()).thenReturn(Person.class);
this.pdxSerializer.setGemfireInstantiators(Collections.singletonMap(Person.class, mockEntityInstantiator));
assertThat(this.pdxSerializer.getInstantiatorFor(mockEntity)).isEqualTo(mockEntityInstantiator);
verify(mockEntity, atLeast(1)).getType();
verifyZeroInteractions(mockEntityInstantiator);
}
@Test
public void getInstantiatorForNonManagedPersistentEntityWithNoEntityInstantiator() {
EntityInstantiator mockEntityInstantiator = mock(EntityInstantiator.class);
PersistentEntity mockEntity = mock(PersistentEntity.class);
when(mockEntity.getType()).thenReturn(Address.class);
this.pdxSerializer.setGemfireInstantiators(Collections.singletonMap(Person.class, mockEntityInstantiator));
assertThat(this.pdxSerializer.getInstantiatorFor(mockEntity)).isNotEqualTo(mockEntityInstantiator);
verify(mockEntity, atLeast(1)).getType();
verifyZeroInteractions(mockEntityInstantiator);
}
@Test
public void isReadableWithNonTransientPropertyReturnsTrue() {
@@ -517,6 +392,113 @@ public class MappingPdxSerializerUnitTests {
verify(mockProperty, times(1)).isTransient();
}
@Test
@SuppressWarnings("all")
public void resolveCustomPdxSerializerReturnsNull() {
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
assertThat(this.pdxSerializer.getCustomPdxSerializers()).isEmpty();
assertThat(this.pdxSerializer.resolveCustomPdxSerializer(addressProperty)).isNull();
}
@Test
@SuppressWarnings("all")
public void resolveCustomPdxSerializerReturnsPdxSerializerForProperty() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockPropertySerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
this.pdxSerializer.setCustomPdxSerializers(MapBuilder.<Object, PdxSerializer>newMapBuilder()
.put(addressProperty, mockPropertySerializer)
.put(toFullyQualifiedPropertyName(addressProperty), mockNamedSerializer)
.put(Address.class, mockTypedSerializer)
.build());
assertThat(this.pdxSerializer.resolveCustomPdxSerializer(addressProperty)).isEqualTo(mockPropertySerializer);
}
@Test
@SuppressWarnings("all")
public void resolveCustomPdxSerializerReturnsPdxSerializerForPropertyName() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
this.pdxSerializer.setCustomPdxSerializers(MapBuilder.<Object, PdxSerializer>newMapBuilder()
.put(toFullyQualifiedPropertyName(addressProperty), mockNamedSerializer)
.put(Address.class, mockTypedSerializer)
.build());
assertThat(this.pdxSerializer.resolveCustomPdxSerializer(addressProperty)).isEqualTo(mockNamedSerializer);
}
@Test
@SuppressWarnings("all")
public void resolveCustomPdxSerializerReturnsPdxSerializerForPropertyType() {
PdxSerializer mockNamedSerializer = mock(PdxSerializer.class);
PdxSerializer mockTypedSerializer = mock(PdxSerializer.class);
Map<Object, PdxSerializer> customPdxSerializers = new HashMap<>();
PersistentEntity personEntity = this.mappingContext.getPersistentEntity(Person.class);
PersistentProperty addressProperty = personEntity.getPersistentProperty("address");
customPdxSerializers.put("example.Type.address", mockNamedSerializer);
customPdxSerializers.put(Address.class, mockTypedSerializer);
this.pdxSerializer.setCustomPdxSerializers(customPdxSerializers);
assertThat(this.pdxSerializer.resolveCustomPdxSerializer(addressProperty)).isEqualTo(mockTypedSerializer);
}
@Test
public void resolveEntityInstantiatorForManagedPersistentEntityWithEntityInstantiator() {
EntityInstantiator mockEntityInstantiator = mock(EntityInstantiator.class);
PersistentEntity mockEntity = mock(PersistentEntity.class);
when(mockEntity.getType()).thenReturn(Person.class);
this.pdxSerializer.setEntityInstantiators(Collections.singletonMap(Person.class, mockEntityInstantiator));
assertThat(this.pdxSerializer.resolveEntityInstantiator(mockEntity)).isEqualTo(mockEntityInstantiator);
verify(mockEntity, atLeast(1)).getType();
verifyZeroInteractions(mockEntityInstantiator);
}
@Test
public void resolveEntityInstantiatorForNonManagedPersistentEntityWithNoEntityInstantiator() {
EntityInstantiator mockEntityInstantiator = mock(EntityInstantiator.class);
PersistentEntity mockEntity = mock(PersistentEntity.class);
when(mockEntity.getType()).thenReturn(Address.class);
this.pdxSerializer.setEntityInstantiators(Collections.singletonMap(Person.class, mockEntityInstantiator));
assertThat(this.pdxSerializer.resolveEntityInstantiator(mockEntity)).isNotEqualTo(mockEntityInstantiator);
verify(mockEntity, atLeast(1)).getType();
verifyZeroInteractions(mockEntityInstantiator);
}
@Test
public void resolveTypeWithNonNullType() {
assertThat(this.pdxSerializer.resolveType("test")).isEqualTo(String.class);
@@ -527,6 +509,24 @@ public class MappingPdxSerializerUnitTests {
assertThat(this.pdxSerializer.resolveType(null)).isNull();
}
@Test
public void toFullyQualifiedPropertyName() {
PersistentEntity mockEntity = mock(PersistentEntity.class);
PersistentProperty mockProperty = mock(PersistentProperty.class);
when(mockProperty.getName()).thenReturn("mockProperty");
when(mockProperty.getOwner()).thenReturn(mockEntity);
when(mockEntity.getType()).thenReturn(Person.class);
assertThat(MappingPdxSerializer.PdxSerializerResolvers.toFullyQualifiedPropertyName(mockProperty))
.isEqualTo(Person.class.getName().concat(".mockProperty"));
verify(mockEntity, times(1)).getType();
verify(mockProperty, times(1)).getName();
verify(mockProperty, times(1)).getOwner();
}
@Test
@SuppressWarnings("unchecked")
public void fromDataDeserializesPdxBytesAndMapsToEntity() {
@@ -539,7 +539,7 @@ public class MappingPdxSerializerUnitTests {
PdxSerializer mockAddressSerializer = mock(PdxSerializer.class);
when(this.mockInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
when(this.mockEntityInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
.thenReturn(new Person(null, null, null));
when(this.mockReader.readField(eq("id"))).thenReturn(1L);
when(this.mockReader.readField(eq("firstname"))).thenReturn("Jon");
@@ -547,7 +547,7 @@ public class MappingPdxSerializerUnitTests {
when(mockAddressSerializer.fromData(eq(Address.class), eq(this.mockReader))).thenReturn(expectedAddress);
this.pdxSerializer.setCustomPdxSerializers(Collections.singletonMap(Address.class, mockAddressSerializer));
this.pdxSerializer.setGemfireInstantiators(Collections.singletonMap(Person.class, this.mockInstantiator));
this.pdxSerializer.setEntityInstantiators(Collections.singletonMap(Person.class, this.mockEntityInstantiator));
this.pdxSerializer.setIncludeTypeFilters(type -> Address.class.isAssignableFrom(type));
this.pdxSerializer.setIncludeTypeFilters(type -> Person.class.isAssignableFrom(type));
@@ -562,7 +562,7 @@ public class MappingPdxSerializerUnitTests {
assertThat(jonDoe.getFirstname()).isEqualTo("Jon");
assertThat(jonDoe.getLastname()).isEqualTo("Doe");
verify(this.mockInstantiator, times(1))
verify(this.mockEntityInstantiator, times(1))
.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class));
verify(this.mockReader, times(1)).readField(eq("id"));
verify(this.mockReader, times(1)).readField(eq("firstname"));
@@ -575,13 +575,13 @@ public class MappingPdxSerializerUnitTests {
@SuppressWarnings("unchecked")
public void fromDataHandlesException() {
when(this.mockInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
when(this.mockEntityInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
.thenReturn(new Person(null, null, null));
when(this.mockReader.readField(eq("id"))).thenThrow(newIllegalArgumentException("test"));
try {
this.pdxSerializer.setGemfireInstantiators(Collections.singletonMap(Person.class, this.mockInstantiator));
this.pdxSerializer.setEntityInstantiators(Collections.singletonMap(Person.class, this.mockEntityInstantiator));
this.pdxSerializer.setIncludeTypeFilters(type -> Person.class.equals(type));
this.pdxSerializer.fromData(Person.class, this.mockReader);
}
@@ -595,7 +595,7 @@ public class MappingPdxSerializerUnitTests {
throw expected;
}
finally {
verify(this.mockInstantiator, times(1))
verify(this.mockEntityInstantiator, times(1))
.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class));
verify(this.mockReader, times(1)).readField(eq("id"));
@@ -618,18 +618,18 @@ public class MappingPdxSerializerUnitTests {
person.address = address;
when(this.mockInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
when(this.mockEntityInstantiator.createInstance(any(GemfirePersistentEntity.class), any(ParameterValueProvider.class)))
.thenReturn(person);
this.pdxSerializer.setCustomPdxSerializers(Collections.singletonMap(Address.class, mockAddressSerializer));
this.pdxSerializer.setGemfireInstantiators(Collections.singletonMap(Person.class, this.mockInstantiator));
this.pdxSerializer.setEntityInstantiators(Collections.singletonMap(Person.class, this.mockEntityInstantiator));
this.pdxSerializer.setIncludeTypeFilters(type -> Person.class.equals(type));
this.pdxSerializer.fromData(Person.class, this.mockReader);
GemfirePersistentEntity<?> persistentEntity =
Optional.ofNullable(this.mappingContext.getPersistentEntity(Person.class)).orElse(null);
verify(this.mockInstantiator, times(1))
verify(this.mockEntityInstantiator, times(1))
.createInstance(eq(persistentEntity), any(ParameterValueProvider.class));
verify(mockAddressSerializer, times(1))