### Question:
EntityDefinition { public void setSchema(NeutralSchema neutralSchema) { this.schema = neutralSchema; this.referenceFields = new LinkedHashMap<String, ReferenceSchema>(); if (this.schema != null) { addRefs("", neutralSchema); } } protected  EntityDefinition(String type, String resourceName, String collectionName, EntityService service,
            boolean supportsAggregates); protected  EntityDefinition(String type, String dbType, String resourceName, String collectionName, EntityService service,
            boolean supportsAggregates, boolean skipContextValidation, boolean pullTypeFromEntity, NeutralCriteria typeCriteria,
            boolean supportsPut, boolean supportsPatch); boolean hasArrayField(String fieldName); NeutralSchema getSchema(); void setSchema(NeutralSchema neutralSchema); Iterable<String> getReferenceFieldNames(String resource); final Map<String, ReferenceSchema> getReferenceFields(); final void addReferencingEntity(EntityDefinition entityDefinition); final Collection<EntityDefinition> getReferencingEntities(); String getStoredCollectionName(); String getType(); String getResourceName(); EntityService getService(); boolean isOfType(String id); boolean isRestrictedForLogging(); static void setDefaultRepo(Repository<Entity> defaultRepo); static Repository<Entity> getDefaultRepo(); boolean supportsAggregates(); boolean skipContextValidation(); boolean wrapperEntity(); String getDbType(); NeutralCriteria getTypeCriteria(); boolean supportsPut(); boolean supportsPatch();  }### Answer:
@Test public void testSetSchema() { NeutralSchema mockSchema = new ComplexSchema(); populate(mockSchema); entityDefinition.setSchema(mockSchema); Map<String, ReferenceSchema> referenceFields = entityDefinition.getReferenceFields(); assertEquals("Expected map with two entries", 3, referenceFields.size()); ReferenceSchema stringSchema = referenceFields.get("StringSchema1"); assertNull("Expected null schema", stringSchema); ReferenceSchema referenceSchema = referenceFields.get("ReferenceSchema1"); assertNotNull("Expected non-null schema", referenceSchema); assertEquals("Expected different reference type", referenceSchema.getType(), "straightReferenceTest"); ReferenceSchema listSchema = referenceFields.get("ListSchema1"); assertNotNull("Expected non-null schema", listSchema); assertEquals("Expected different reference type", listSchema.getType(), "listReferenceTest"); assertTrue(entityDefinition.hasArrayField("ListSchema1")); assertFalse(entityDefinition.hasArrayField("StringSchema1")); assertFalse(entityDefinition.hasArrayField("Foo")); }