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.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.hamcrest.MatcherAssert.assertThat;
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertThrows;
16 import org.junit.Test;
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;
22 * Test for testing of extensions and their arguments.
24 public class ParsingExtensionValueTest {
26 public void extensionTest() {
27 final ReactorException ex = assertThrows(ReactorException.class,
28 () -> TestUtils.loadModules(getClass().getResource("/extensions").toURI()));
29 assertEquals(SomeModifiersUnresolvedException.class, ex.getClass());
30 final Throwable cause = ex.getCause();
31 assertThat(cause, instanceOf(SourceException.class));
32 assertThat(cause.getMessage(), startsWith("ext:id is not a YANG statement or use of extension"));