BUG-1902: reuse ConcreteTypeImpl instances
[yangtools.git] / code-generator / binding-generator-util / src / test / java / org / opendaylight / yangtools / binding / generator / util / BindingGeneratorUtilTest.java
index 9a572b35db59b94b200648b19d15e1053c96c9e7..ef268c7ed998cef2e10637677fe3828b351a8531 100644 (file)
@@ -13,17 +13,17 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
+import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
 import org.opendaylight.yangtools.yang.model.util.DataNodeIterator;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -54,10 +54,10 @@ public class BindingGeneratorUtilTest {
      * - without revision </ul>
      */
     @Test
-    public void testBindingGeneratorUtilMethods() {
+    public void testBindingGeneratorUtilMethods() throws IOException {
         List<File> testModels = loadTestResources("/module.yang");
-        final YangModelParser parser = new YangParserImpl();
-        final Set<Module> modules = parser.parseYangModels(testModels);
+        final YangContextParser parser = new YangParserImpl();
+        final Set<Module> modules = parser.parseFiles(testModels).getModules();
         String packageName = "";
         Module module = null;
         for (Module m : modules) {
@@ -101,6 +101,7 @@ public class BindingGeneratorUtilTest {
 
         // test of exception part of the method moduleNamespaceToPackageName()
         ModuleBuilder moduleBuilder = new ModuleBuilder("module-withut-revision", null);
+        moduleBuilder.setSource("");
         Module moduleWithoutRevision = moduleBuilder.build();
         boolean passedSuccesfully = false;
         try {