2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.stmt;
10 import static org.hamcrest.MatcherAssert.assertThat;
11 import static org.hamcrest.Matchers.isA;
12 import static org.junit.Assert.assertEquals;
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;
19 public class YT956Test extends AbstractYangTest {
20 private static final QName ANOTHER_CONTAINER = QName.create("http://www.example.com/anothermodule",
22 private static final QName FIRST_AUGMENT = QName.create("http://www.example.com/mainmodule", "first-augment");
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;
31 final DataSchemaNode first = anotherContainer.findDataChildByName(FIRST_AUGMENT).get();
32 assertThat(first, isA(ContainerSchemaNode.class));
33 final ContainerSchemaNode firstAugment = (ContainerSchemaNode) first;
35 // Augmentation needs to be added
36 assertEquals(3, firstAugment.getChildNodes().size());