### Question:
EntityTreeNodeIdConverter extends AbstractConverter<EntityReference> { @Override protected String convertToString(EntityReference entityReference) { if (entityReference == null) { return null; } return underscoreToCamelCase(entityReference.getType().name().toLowerCase()) + ':' + this.defaultEntityReferenceSerializer.serialize(entityReference); }    }### Answer:
@Test public void convertNullToString() { assertNull(this.converter.convertToString(null)); }
@Test public void convertToString() { DocumentReference documentReference = new DocumentReference("wiki", Arrays.asList("Path", "To"), "Page"); when(this.defaultEntityReferenceSerializer.serialize(documentReference)).thenReturn("wiki:Path.To.Page"); assertEquals("document:wiki:Path.To.Page", this.converter.convertToString(documentReference)); ClassPropertyReference classPropertyReference = new ClassPropertyReference("age", documentReference); when(this.defaultEntityReferenceSerializer.serialize(classPropertyReference)) .thenReturn("wiki:Path.To.Page^age"); assertEquals("classProperty:wiki:Path.To.Page^age", this.converter.convertToString(classPropertyReference)); }