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.assertNotNull;
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.AnyxmlSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
18 class NotificationStmtTest extends AbstractYangTest {
20 void notificationTest() throws Exception {
21 final var result = assertEffectiveModel("/model/baz.yang", "/model/bar.yang");
23 final var testModule = result.findModules("baz").iterator().next();
24 assertNotNull(testModule);
26 final var notifications = testModule.getNotifications();
27 assertEquals(1, notifications.size());
29 final var notification = notifications.iterator().next();
30 assertEquals("event", notification.getQName().getLocalName());
31 assertEquals(3, notification.getChildNodes().size());
33 var leaf = (LeafSchemaNode) notification.getDataChildByName(QName.create(testModule.getQNameModule(),
36 leaf = (LeafSchemaNode) notification.getDataChildByName(QName.create(testModule.getQNameModule(), "severity"));
38 final var anyXml = (AnyxmlSchemaNode) notification.getDataChildByName(QName.create(
39 testModule.getQNameModule(), "reporting-entity"));
40 assertNotNull(anyXml);