Further cleanup of tests
[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.hamcrest.MatcherAssert.assertThat;
11 import static org.hamcrest.Matchers.isA;
12 import static org.junit.Assert.assertEquals;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18
19 public class YT956Test extends AbstractYangTest {
20     private static final QName ANOTHER_CONTAINER = QName.create("http://www.example.com/anothermodule",
21         "another-container");
22     private static final QName FIRST_AUGMENT = QName.create("http://www.example.com/mainmodule", "first-augment");
23
24     @Test
25     public void testAugmentationConditional() {
26         final DataSchemaNode another = assertEffectiveModelDir("/bugs/YT956/")
27                 .getDataChildByName(ANOTHER_CONTAINER);
28         assertThat(another, isA(ContainerSchemaNode.class));
29         final ContainerSchemaNode anotherContainer = (ContainerSchemaNode) another;
30
31         final DataSchemaNode first = anotherContainer.findDataChildByName(FIRST_AUGMENT).get();
32         assertThat(first, isA(ContainerSchemaNode.class));
33         final ContainerSchemaNode firstAugment = (ContainerSchemaNode) first;
34
35         // Augmentation needs to be added
36         assertEquals(3, firstAugment.getChildNodes().size());
37     }
38 }