### Question:
EntityTreeNodeIdConverter extends AbstractConverter<EntityReference> { @SuppressWarnings("unchecked") @Override protected EntityReference convertToType(Type targetType, Object value) { String[] parts = StringUtils.split(String.valueOf(value), ":", 2); if (parts == null || parts.length != 2) { return null; } try { EntityType entityType = EntityType.valueOf(camelCaseToUnderscore(parts[0]).toUpperCase()); return this.currentEntityReferenceResolver.resolve(parts[1], entityType); } catch (IllegalArgumentException e) { return null; } }    }### Answer:
@Test public void convertToEntityReferenceWithoutEntityType() { assertNull(this.converter.convertToType(null, "test")); }
@Test public void convertToEntityReferenceWithInvalidEntityType() { assertNull(this.converter.convertToType(null, "foo:bar")); }
@Test public void convertToEntityReference() { DocumentReference documentReference = new DocumentReference("wiki", Arrays.asList("Path", "To"), "Page"); when(this.currentEntityReferenceResolver.resolve("wiki:Path.To.Page", EntityType.DOCUMENT)) .thenReturn(documentReference); assertEquals(documentReference, this.converter.convertToType(null, "document:wiki:Path.To.Page")); ClassPropertyReference classPropertyReference = new ClassPropertyReference("age", documentReference); when(this.currentEntityReferenceResolver.resolve("wiki:Path.To.Page^age", EntityType.CLASS_PROPERTY)) .thenReturn(classPropertyReference); assertEquals(classPropertyReference, this.converter.convertToType(null, "classProperty:wiki:Path.To.Page^age")); }