@Test public void testGetSelfReferenceFields() { Entity srEntity = Mockito.mock(Entity.class); Mockito.when(srEntity.getType()).thenReturn(SELF_REFERENCE_COLLECTION); Entity nonSrEntity = Mockito.mock(Entity.class); Mockito.when(nonSrEntity.getType()).thenReturn(NON_SELF_REFERENCE_COLLECTION); String selfReferenceField = selfReferenceExtractor.getSelfReferenceFields(srEntity); Assert.assertEquals("field2", selfReferenceField); selfReferenceField = selfReferenceExtractor.getSelfReferenceFields(nonSrEntity); Assert.assertEquals(null, selfReferenceField); }
public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenceFields(schema, ""); } } return selfReferenceField; }
SelfReferenceExtractor { public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenceFields(schema, ""); } } return selfReferenceField; } }
SelfReferenceExtractor { public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenceFields(schema, ""); } } return selfReferenceField; }  }
SelfReferenceExtractor { public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenceFields(schema, ""); } } return selfReferenceField; }  String getSelfReferenceFields(Entity entity); Map<String, NeutralSchema> getSchemaFields(NeutralSchema schema); }
SelfReferenceExtractor { public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenceFields(schema, ""); } } return selfReferenceField; }  String getSelfReferenceFields(Entity entity); Map<String, NeutralSchema> getSchemaFields(NeutralSchema schema);  }