9208e4102cd82fb595779c451f524cd78fed4f81
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT956Test.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.stmt;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
12
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
16
17 class YT956Test extends AbstractYangTest {
18     private static final QName ANOTHER_CONTAINER = QName.create("http://www.example.com/anothermodule",
19         "another-container");
20     private static final QName FIRST_AUGMENT = QName.create("http://www.example.com/mainmodule", "first-augment");
21
22     @Test
23     void testAugmentationConditional() {
24         final var another = assertEffectiveModelDir("/bugs/YT956/").getDataChildByName(ANOTHER_CONTAINER);
25         final var anotherContainer = assertInstanceOf(ContainerSchemaNode.class, another);
26
27         final var first = anotherContainer.findDataChildByName(FIRST_AUGMENT).get();
28         final var firstAugment = assertInstanceOf(ContainerSchemaNode.class, first);
29
30         // Augmentation needs to be added
31         assertEquals(3, firstAugment.getChildNodes().size());
32     }
33 }