### Question:
CompositeMetadata extends EntityMetadata { public static CompositeMetadata buildCompositeMetadata(EntityMetadata root, GetMetadata gmd) { LOGGER.debug("enter buildCompositeMetadata"); Error.push("compositeMetadata"); try { CompositeMetadata cmd = buildCompositeMetadata(root, gmd, new Path(), null, new MutablePath()); return cmd; } finally { LOGGER.debug("end buildCompositeMetadata"); Error.pop(); } } CompositeMetadata(EntityInfo info,
                             CompositeSchema schema);  CompositeMetadata(EntityInfo info,
                             CompositeSchema schema,
                             Path path,
                             CompositeMetadata parent); Path getEntityPath(); boolean isSimple(); CompositeMetadata getParent(); CompositeMetadata getChildMetadata(Path entityPath); ResolvedReferenceField getDescendantReference(Path entityPath); CompositeMetadata getDescendantMetadata(Path entityPath); ResolvedReferenceField getChildReference(Path entityPath); Set<Path> getChildPaths(); String toTreeString(); @Override String toString(); CompositeMetadata getEntityOfPath(Path path); CompositeMetadata getEntityOfField(FieldTreeNode field); ResolvedReferenceField getResolvedReferenceOfField(Path field); ResolvedReferenceField getResolvedReferenceOfField(FieldTreeNode field); Path getEntityRelativeFieldName(FieldTreeNode fieldNode); static CompositeMetadata buildCompositeMetadata(EntityMetadata root,
                                                           GetMetadata gmd);  }### Answer:
@Test public void accessToRefTest() throws Exception { EntityMetadata md = getMd("composite/C.json"); CompositeMetadata c = CompositeMetadata.buildCompositeMetadata(md, new SimpleGMD()); Assert.assertNotNull(c.resolve(new Path("obj1.d"))); }
@Test public void fields_a() throws Exception { EntityMetadata md = getMd("composite/A.json"); CompositeMetadata a = CompositeMetadata.buildCompositeMetadata(md, new SimpleGMD()); Assert.assertEquals(6, a.getEntitySchema().getFields().getNumChildren()); ArrayField bfields = (ArrayField) a.getEntitySchema().getFields().getField("b"); Assert.assertNotNull(bfields); Assert.assertEquals(4, ((ObjectArrayElement) bfields.getElement()).getFields().getNumChildren()); }
@Test public void defaultVersionInRefTest() throws Exception { EntityMetadata md=getMd("composite/A_def.json"); CompositeMetadata a = CompositeMetadata.buildCompositeMetadata(md, new SimpleGMD()); ResolvedReferenceField ref = (ResolvedReferenceField) a.resolve(new Path("obj1.c")); Assert.assertNotNull(ref); }