SGF-475 - Add additional logging to the MappingPdxSerializer.

(cherry picked from commit 6dfd3e7082628f4c05da951ff760861ebb242899)
Signed-off-by: John Blum <jblum@pivotal.io>
This commit is contained in:
John Blum
2016-03-01 14:08:52 -08:00
parent b68c1f450c
commit a0c8950e1f
3 changed files with 71 additions and 24 deletions

View File

@@ -170,7 +170,8 @@ public class MappingPdxSerializerUnitTests {
try {
expectedException.expect(MappingException.class);
expectedException.expectCause(isA(IllegalArgumentException.class));
expectedException.expectMessage("Could not read and set value [null] for property [id]");
expectedException.expectMessage(String.format(
"while setting value [null] of property [id] for entity of type [%1$s] from PDX", Person.class));
serializer.fromData(Person.class, mockReader);
}
@@ -216,7 +217,9 @@ public class MappingPdxSerializerUnitTests {
try {
expectedException.expect(MappingException.class);
expectedException.expectCause(isA(IllegalArgumentException.class));
expectedException.expectMessage("Could not write value for property [address]");
expectedException.expectMessage(String.format(
"while serializing value [Portland, 12345] of property [address] for entity of type [%1$s] to PDX",
Person.class));
new MappingPdxSerializer(context, conversionService).toData(jonDoe, mockWriter);
}

View File

@@ -24,8 +24,15 @@ import org.springframework.data.gemfire.mapping.Region;
*/
@Region("address")
public class Address {
@Id
public String zipCode;
public String city;
@Override
public String toString() {
return String.format("%1$s, %2$s", city, zipCode);
}
}