7ae29ed4c6f621b21c1cce6b54ee4f11932713e2
[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 = YangTextSnippet.builder(stmt, stmt.getDeclared()).build().toString();
29             assertNotNull(str);
30         }
31     }
32 }