### Question:
SolrIndexScriptService implements ScriptService { public EntityReference resolve(SolrDocument document, Object... parameters) { EntityType type; try { type = EntityType.valueOf((String) document.get(FieldUtils.TYPE)); } catch (IllegalArgumentException e) { return null; } catch (NullPointerException e) { return null; } return resolve(document, type, parameters); }  void index(EntityReference reference); void index(List<EntityReference> references); void delete(EntityReference reference); void delete(List<EntityReference> references); int getQueueSize(); DocumentReference resolveDocument(SolrDocument document, Object... parameters); EntityReference resolve(SolrDocument document, Object... parameters); EntityReference resolve(SolrDocument document, EntityType type, Object... parameters); static final String CONTEXT_LASTEXCEPTION; }### Answer:
@Test public void resolveWithImplicitType() throws Exception { SolrDocument document = new SolrDocument(); Object[] parameters = new Object[] {}; assertNull(this.service.resolve(document, parameters)); document.setField(FieldUtils.TYPE, "foo"); assertNull(this.service.resolve(document, parameters)); EntityReferenceResolver<SolrDocument> solrEntityReferenceResolver = this.mocker.getInstance(SolrEntityReferenceResolver.TYPE); EntityReference spaceReference = new EntityReference("bar", EntityType.SPACE); when(solrEntityReferenceResolver.resolve(document, EntityType.SPACE, parameters)).thenReturn(spaceReference); document.setField(FieldUtils.TYPE, "SPACE"); assertSame(spaceReference, this.service.resolve(document, parameters)); }