Fixed incorrect path construction in JUnit tests.
[yangtools.git] / code-generator / binding-generator-util / src / test / java / org / opendaylight / yangtools / binding / generator / util / BindingGeneratorUtilTest.java
index 4f458c0c7e1765b56816130ccb796161921f0e39..4b7a86539d126838bdd869b0bfd5472d55414d66 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
 import java.io.File;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -30,7 +31,12 @@ public class BindingGeneratorUtilTest {
 
     private static List<File> loadTestResources(String testFile) {
         final List<File> testModels = new ArrayList<File>();
-        final File listModelFile = new File(BindingGeneratorUtilTest.class.getResource(testFile).getPath());
+        File listModelFile;
+        try {
+            listModelFile = new File(BindingGeneratorUtilTest.class.getResource(testFile).toURI());
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException("Failed to load sources from " + testFile);
+        }
         testModels.add(listModelFile);
         return testModels;
     }