Bug 4540: Yang parser exceptions should follow consistent path
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / retest / YangParserIdentityTest.java
index 5021e89e921f23d85df08d14e6ce36c65deb1c85..662022dbabc22114e2e20f5783daa83043067825 100644 (file)
@@ -1,9 +1,16 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.yangtools.yang.stmt.retest;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
@@ -13,6 +20,7 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
+import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
 import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class YangParserIdentityTest {
@@ -22,7 +30,7 @@ public class YangParserIdentityTest {
     public void testParsingIdentityTestModule() throws URISyntaxException,
             ReactorException, FileNotFoundException {
         File yang = new File(getClass().getResource("/identity/identitytest.yang").toURI());
-        InputStream stream = new FileInputStream(yang);
+        InputStream stream = new NamedFileInputStream(yang, yang.getPath());
         try {
             TestUtils.loadModule(stream);
         } catch (SomeModifiersUnresolvedException e) {
@@ -36,7 +44,7 @@ public class YangParserIdentityTest {
     public void testParsingPrefixIdentityTestModule() throws URISyntaxException,
             ReactorException, FileNotFoundException {
         File yang = new File(getClass().getResource("/identity/prefixidentitytest.yang").toURI());
-        InputStream stream = new FileInputStream(yang);
+        InputStream stream = new NamedFileInputStream(yang, yang.getPath());
         try {
             TestUtils.loadModule(stream);
         } catch (SomeModifiersUnresolvedException e) {