Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-model-export / src / test / java / org / opendaylight / yangtools / yang / model / export / YangTextSnippetTest.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.export;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertTrue;
12
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.model.api.Module;
15 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
17 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
18
19 public class YangTextSnippetTest {
20     @Test
21     public void testNotification() {
22         final SchemaContext schema = YangParserTestUtils.parseYangResource("/bugs/bug2444/yang/notification.yang");
23
24         for (Module module : schema.getModules()) {
25             assertTrue(module instanceof ModuleEffectiveStatement);
26             final ModuleEffectiveStatement stmt = (ModuleEffectiveStatement) module;
27
28             final String str = DeclaredStatementFormatter.defaultInstance().toYangTextSnippet(stmt, stmt.getDeclared())
29                     .toString();
30             assertNotNull(str);
31         }
32     }
33 }