2 * Copyright (c) 2016 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;
12 import static org.junit.jupiter.api.Assertions.assertNotNull;
14 import org.junit.jupiter.api.Test;
15 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.Module;
17 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
18 import org.opendaylight.yangtools.yang.model.api.Submodule;
20 class Bug3799Test extends AbstractYangTest {
23 final var schema = assertEffectiveModelDir("/bugs/bug3799");
25 var modules = schema.getModules();
26 assertNotNull(modules);
27 assertEquals(1, modules.size());
29 Module testModule = modules.iterator().next();
30 var subModules = testModule.getSubmodules();
31 assertNotNull(subModules);
32 assertEquals(1, subModules.size());
34 Submodule testSubmodule = subModules.iterator().next();
36 var notifications = testSubmodule.getNotifications();
37 assertNotNull(notifications);
38 assertEquals(1, notifications.size());
40 NotificationDefinition bazNotification = notifications.iterator().next();
41 var childNodes = bazNotification.getChildNodes();
42 assertNotNull(childNodes);
43 assertEquals(1, childNodes.size());
45 LeafSchemaNode leafBar = assertInstanceOf(LeafSchemaNode.class, childNodes.iterator().next());
46 assertEquals("bar", leafBar.getQName().getLocalName());