### Question:
SolrFieldStringEntityReferenceSerializer implements EntityReferenceSerializer<String> { @Override public String serialize(EntityReference reference, Object... parameters) { if (reference == null) { return null; } StringBuilder output = new StringBuilder(); for (EntityReference parent : reference.getReversedReferenceChain()) { output.append(SEPARATOR).append(parent.getName().replace(SEPARATOR, "..")); } return output.substring(1); }  @Override String serialize(EntityReference reference, Object... parameters);  }### Answer:
@Test public void serialize() { assertNull(serializer.serialize(null)); assertEquals("math.My App.Code.Some Class.title", serializer.serialize(new ClassPropertyReference("title", new DocumentReference("math", Arrays.asList("My App", "Code"), "Some Class")))); assertEquals("ma..th.My..App.Co....de.Some..Class.ti..tle", serializer.serialize(new ClassPropertyReference( "ti.tle", new DocumentReference("ma.th", Arrays.asList("My.App", "Co..de"), "Some.Class")))); }