Merge "Fix for Bug 308."
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / TestUtils.java
index 760d0407ed77aa55916b7c81d607e18f03c360c9..e66a8dc0b0da0240c65f76cf15fe33055eac63e7 100644 (file)
@@ -25,6 +25,10 @@ final class TestUtils {
 
     public static Set<Module> loadModules(String resourceDirectory) throws FileNotFoundException {
         YangModelParser parser = new YangParserImpl();
+        return loadModules(resourceDirectory, parser);
+    }
+
+    public static Set<Module> loadModules(String resourceDirectory, YangModelParser parser) throws FileNotFoundException {
         final File testDir = new File(resourceDirectory);
         final String[] fileList = testDir.list();
         final List<File> testFiles = new ArrayList<>();
@@ -191,4 +195,14 @@ final class TestUtils {
         }
     }
 
+    public static List<Module> findModules(Set<Module> modules, String moduleName) {
+        List<Module> result = new ArrayList<>();
+        for (Module module : modules) {
+            if (module.getName().equals(moduleName)) {
+                result.add(module);
+            }
+        }
+        return result;
+    }
+
 }