BUG-9043: Remove use of CheckedFuture from YANG components
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / repo / MultipleRevImportBug6875Test.java
index 9c2a3e86e3e0441c20fbae88606c2fc0f080c253..0a1ad9b1b868774e1059ccb027bae297a97510b6 100644 (file)
@@ -14,8 +14,8 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@@ -23,7 +23,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaContextFactory;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceFilter;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
@@ -100,18 +99,18 @@ public class MultipleRevImportBug6875Test {
         setAndRegister(sharedSchemaRepository, bar1);
         setAndRegister(sharedSchemaRepository, bar2);
 
-        final SchemaContextFactory fact = sharedSchemaRepository
-                .createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
-
-        final CheckedFuture<SchemaContext, SchemaResolutionException> schemaContextFuture = fact
-                .createSchemaContext(ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
+        final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(
+                SchemaSourceFilter.ALWAYS_ACCEPT);
+        final ListenableFuture<SchemaContext> schemaContextFuture = fact.createSchemaContext(
+                ImmutableList.of(foo.getId(), bar1.getId(), bar2.getId()));
         assertTrue(schemaContextFuture.isDone());
 
         try {
-            schemaContextFuture.checkedGet();
+            schemaContextFuture.get();
             fail("Test should fail due to invalid imports of yang source.");
-        } catch (final SchemaResolutionException e) {
-            assertTrue(e.getCause().getMessage().startsWith("Module:bar imported twice with different revisions"));
+        } catch (final ExecutionException e) {
+            assertTrue(e.getCause().getMessage().startsWith(
+                "Module:bar imported twice with different revisions"));
         }
     }