2 * Copyright (c) 2020 PANTHEON.tech, 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.CoreMatchers.instanceOf;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertEquals;
14 import com.google.common.collect.Iterables;
15 import java.util.Optional;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
22 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
24 public class YT859Test {
26 public void testAugmentUnsupported() throws Exception {
27 final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/YT859/", Set.of(),
28 YangParserConfiguration.DEFAULT);
29 assertEquals(4, context.getModules().size());
31 final DataSchemaNode named = Iterables.getOnlyElement(context.findModules("xyzzy"))
32 .findDataChildByName(QName.create("xyzzy", "xyzzy"), QName.create("xyzzy", "named")).orElseThrow();
33 assertThat(named, instanceOf(ListSchemaNode.class));
34 assertEquals(Optional.empty(), ((ListSchemaNode) named).findDataChildByName(QName.create("foo", "foo")));