### Question:
AliasManager { public String getAlias(EntityMetamodel<?> entityMetamodel) { return getAlias(entityMetamodel, AliasManager::getAlias, entityAliasMap::get); } AliasManager(Context context);  AliasManager(Context context, AliasManager parent); String getAlias(EntityMetamodel<?> entityMetamodel); String getAlias(PropertyMetamodel<?> propertyMetamodel);  }### Answer:
@Test void entityDef() { AliasManager manager = new AliasManager(new ContextImpl(Arrays.asList(e, d))); Assertions.assertEquals("t0_", manager.getAlias(e)); Assertions.assertEquals("t1_", manager.getAlias(d)); }
@Test void entityDef_notFound() { AliasManager manager = new AliasManager(new ContextImpl(Arrays.asList(e, d))); Assertions.assertNull(manager.getAlias(e2)); }
@Test void propertyMetamodel() { AliasManager manager = new AliasManager(new ContextImpl(Arrays.asList(e, d))); Assertions.assertEquals("t0_", manager.getAlias(e.name)); Assertions.assertEquals("t1_", manager.getAlias(d.name)); }
@Test void propertyMetamodel_notFound() { AliasManager manager = new AliasManager(new ContextImpl(Arrays.asList(e, d))); Assertions.assertNull(manager.getAlias(e2.name)); }
@Test void entityMetamodel_parent() { AliasManager parent = new AliasManager(new ContextImpl(Arrays.asList(e, d))); AliasManager child = new AliasManager(new ContextImpl(Arrays.asList(e2, d2)), parent); Assertions.assertEquals("t0_", child.getAlias(e)); Assertions.assertEquals("t1_", child.getAlias(d)); Assertions.assertEquals("t2_", child.getAlias(e2)); Assertions.assertEquals("t3_", child.getAlias(d2)); }
@Test void propertyMetamodel_parent() { AliasManager parent = new AliasManager(new ContextImpl(Arrays.asList(e, d))); AliasManager child = new AliasManager(new ContextImpl(Arrays.asList(e2, d2)), parent); Assertions.assertEquals("t0_", child.getAlias(e.name)); Assertions.assertEquals("t1_", child.getAlias(d.name)); Assertions.assertEquals("t2_", child.getAlias(e2.name)); Assertions.assertEquals("t3_", child.getAlias(d2.name)); }