2 * Copyright (c) 2017 Cisco Systems, Inc. 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.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
13 import java.util.Optional;
14 import org.junit.jupiter.api.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.common.XMLNamespace;
17 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
20 class Bug7879Test extends AbstractYangTest {
21 private static final XMLNamespace NS = XMLNamespace.of("my-model-ns");
24 void test() throws Exception {
25 final var module = assertEffectiveModelDir("/bugs/bug7879").getModuleStatement(qn("my-model"));
27 assertInstanceOf(ContainerSchemaNode.class, module.findSchemaTreeNode(
28 qn("my-alarm"), qn("my-content"), qn("my-event-container")).orElseThrow());
30 assertEquals(Optional.of("new description"),
31 assertInstanceOf(LeafSchemaNode.class, module.findSchemaTreeNode(
32 qn("my-alarm"), qn("my-content"), qn("my-event-value")).orElseThrow()).getDescription());
35 private static QName qn(final String localName) {
36 return QName.create(NS, localName);