use of org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement in project yangtools by opendaylight.
the class YT1208Test method testUsesStatementReuse.
@Test
public void testUsesStatementReuse() throws Exception {
final ModuleEffectiveStatement module = StmtTestUtils.parseYangSource("/bugs/YT1208/uses.yang").getModuleStatement(QNameModule.create(XMLNamespace.of("foo")));
assertNotNull(module);
final List<GroupingEffectiveStatement> groupings = module.streamEffectiveSubstatements(GroupingEffectiveStatement.class).collect(Collectors.toList());
assertEquals(2, groupings.size());
final ContainerEffectiveStatement grpFoo = groupings.get(1).findFirstEffectiveSubstatement(ContainerEffectiveStatement.class).orElseThrow();
final ContainerEffectiveStatement foo = module.findFirstEffectiveSubstatement(ContainerEffectiveStatement.class).orElseThrow();
assertNotSame(foo, grpFoo);
assertSame(foo.findFirstEffectiveSubstatement(UsesEffectiveStatement.class).orElseThrow(), grpFoo.findFirstEffectiveSubstatement(UsesEffectiveStatement.class).orElseThrow());
}
Aggregations