YANGTOOLS-706: Split out yang-parser-rfc7950
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / ParsingExtensionValueTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.stmt;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import java.io.IOException;
14 import java.net.URISyntaxException;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
19 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
20
21 /**
22  * Test for testing of extensions and their arguments.
23  *
24  * @author Lukas Sedlak <lsedlak@cisco.com>
25  */
26 public class ParsingExtensionValueTest {
27
28     @Test
29     public void extensionTest() throws IOException, YangSyntaxErrorException, URISyntaxException {
30         try {
31             TestUtils.loadModules(getClass().getResource("/extensions").toURI());
32         } catch (ReactorException e) {
33             assertEquals(SomeModifiersUnresolvedException.class, e.getClass());
34             assertTrue(e.getCause() instanceof SourceException);
35             assertTrue(e.getCause().getMessage().startsWith("ext:id is not a YANG statement or use of extension"));
36         }
37     }
38 }