### Question:
DeprecatedLocalReferenceEntityReferenceSerializer implements EntityReferenceSerializer { @Override public EntityReference serialize(EntityReference reference, Object... parameters) { EntityReference newReference = null; EntityReference parent; for (EntityReference currentReference = reference; currentReference != null; currentReference = currentReference.getParent()) { if (currentReference.getType() == EntityType.WIKI) { return newReference; } parent = new EntityReference(currentReference.getName(), currentReference.getType()); if (newReference != null) { newReference = newReference.appendParent(parent); } else { newReference = parent; } } return newReference; }  @Override EntityReference serialize(EntityReference reference, Object... parameters);  }### Answer:
@Test public void testSerializeDocumentReference() throws Exception { EntityReference reference = this.serializer.serialize(new DocumentReference("wiki", "space", "page")); Assert.assertEquals(EntityType.DOCUMENT, reference.getType()); Assert.assertEquals("page", reference.getName()); Assert.assertEquals(EntityType.SPACE, reference.getParent().getType()); Assert.assertEquals("space", reference.getParent().getName()); Assert.assertNull(reference.getParent().getParent()); }
@Test public void testSerializeSpaceReferenceWithChild() { EntityReference reference = this.serializer.serialize(new SpaceReference("space", new WikiReference("wiki"))); Assert.assertEquals(EntityType.SPACE, reference.getType()); Assert.assertEquals("space", reference.getName()); Assert.assertNull(reference.getParent()); }