### Question:
SolrFieldStringEntityReferenceResolver extends AbstractEntityReferenceResolver implements
    EntityReferenceResolver<String> { @Override public EntityReference resolve(String entityReferenceRepresentation, EntityType type, Object... parameters) { EntityType[] entityTypesForType = ENTITY_TYPES.get(type); if (entityTypesForType == null) { throw new RuntimeException("No parsing definition found for Entity Type [" + type + "]"); } EntityReference entityReference = null; int entityTypeOffset = 0; int offset = entityReferenceRepresentation.length() - 1; while (offset >= 0) { entityTypeOffset = Math.min(entityTypeOffset, entityTypesForType.length - 2); StringBuilder entityName = new StringBuilder(); offset = readEntityName(entityReferenceRepresentation, entityName, offset); EntityReference parent = getNewEntityReference(entityName.reverse().toString(), entityTypesForType[entityTypeOffset++], parameters); entityReference = entityReference == null ? parent : entityReference.appendParent(parent); } for (int i = entityTypeOffset; i < entityTypesForType.length; i++) { EntityReference parent = resolveDefaultReference(entityTypesForType[i], parameters); if (parent != null) { entityReference = entityReference == null ? parent : entityReference.appendParent(parent); } else { break; } } return entityReference; }  @Override EntityReference resolve(String entityReferenceRepresentation, EntityType type, Object... parameters);  }### Answer:
@Test public void resolve() throws Exception { EntityReferenceProvider currentEntityReferenceProvider = this.mocker.getInstance(EntityReferenceProvider.class, "current"); when(currentEntityReferenceProvider.getDefaultReference(EntityType.WIKI)).thenReturn(new WikiReference("test")); EntityReferenceResolver<String> resolver = mocker.getComponentUnderTest(); DocumentReference documentReference = new DocumentReference("test", Arrays.asList("My App", "Code", "Model"), "A Class"); assertEquals(new ClassPropertyReference("title", documentReference), new ClassPropertyReference(resolver.resolve("My App.Code.Model.A Class.title", EntityType.CLASS_PROPERTY))); documentReference = new DocumentReference("test", Arrays.asList("My.App", "Co.de"), "A.Class"); assertEquals(new ClassPropertyReference("ti.tle", documentReference), new ClassPropertyReference(resolver.resolve("My..App.Co..de.A..Class.ti..tle", EntityType.CLASS_PROPERTY))); assertEquals(new SpaceReference("0.9", new SpaceReference("a..z", new WikiReference("test"))), new SpaceReference(resolver.resolve("a....z.0..9", EntityType.SPACE))); assertEquals( new ClassPropertyReference("title", new DocumentReference("foo", Arrays.asList("Code", "Model"), "A Class")), new ClassPropertyReference(resolver.resolve("Code.Model.A Class.title", EntityType.CLASS_PROPERTY, new SpaceReference("My App", new WikiReference("foo"))))); when(currentEntityReferenceProvider.getDefaultReference(EntityType.SPACE)).thenReturn( new EntityReference("Code", EntityType.SPACE, new EntityReference("My App", EntityType.SPACE))); assertEquals( new ClassPropertyReference("title", new DocumentReference("bar", Arrays.asList("My App", "Code"), "A Class")), new ClassPropertyReference(resolver.resolve("A Class.title", EntityType.CLASS_PROPERTY, new WikiReference( "bar")))); }