Introduce binding.EntryObject
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / parser / stmt / rfc7950 / Bug6884Test.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.parser.stmt.rfc7950;
9
10 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
11
12 import org.junit.jupiter.api.Test;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
16 import org.opendaylight.yangtools.yang.stmt.AbstractYangTest;
17
18 class Bug6884Test extends AbstractYangTest {
19     @Test
20     void testYang11() {
21         final var schemaContext = assertEffectiveModelDir("/rfc7950/bug6884/yang1-1");
22         final DataSchemaNode node = schemaContext.findDataTreeChild(foo("sub-root"), foo("sub-foo-2-con")).orElse(null);
23         assertInstanceOf(ContainerSchemaNode.class, node);
24     }
25
26     @Test
27     void testCircularIncludesYang10() {
28         final var schemaContext = assertEffectiveModelDir("/rfc7950/bug6884/circular-includes");
29         DataSchemaNode node = schemaContext.findDataTreeChild(foo("sub-root"), foo("sub-foo-2-con")).orElse(null);
30         assertInstanceOf(ContainerSchemaNode.class, node);
31
32         node = schemaContext.findDataTreeChild(foo("sub-root-2"), foo("sub-foo-con")).orElse(null);
33         assertInstanceOf(ContainerSchemaNode.class, node);
34     }
35
36     private static QName foo(final String localName) {
37         return QName.create("foo", localName);
38     }
39 }