Fix broken tests according to yangtools changes
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / yang / types / Bug4621.java
index 81b733b8261596e655c8303f7a1c7ff799ffd513..1577884e76a22bb22d0a0a6fc03cbe3eadd7e5a2 100644 (file)
@@ -10,13 +10,10 @@ package org.opendaylight.mdsal.binding.yang.types;
 import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
@@ -24,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class Bug4621 {
@@ -33,10 +29,10 @@ public class Bug4621 {
     public ExpectedException expectedEx = ExpectedException.none();
 
     @Test
-    public void bug4621test() throws FileNotFoundException, ReactorException, URISyntaxException {
-        File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
+    public void bug4621test() throws Exception {
+        final File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(file);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(file);
         final Module moduleValid = schemaContext.findModuleByNamespace(new URI("foo")).iterator().next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
 
@@ -44,10 +40,10 @@ public class Bug4621 {
 
         final QName listNode = QName.create(moduleValid.getQNameModule(), "neighbor");
         final QName leafrefNode = QName.create(moduleValid.getQNameModule(), "neighbor2-id");
-        DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
+        final DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
                 .getDataChildByName(leafrefNode);
-        LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
-        TypeDefinition<?> leafTypeRel = leafRel.getType();
+        final LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
+        final TypeDefinition<?> leafTypeRel = leafRel.getType();
         assertNotNull(typeProvider.javaTypeForSchemaDefinitionType(leafTypeRel, leafRel));
     }
 }
\ No newline at end of file