BUG-9043: Remove use of CheckedFuture from YANG components
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / repo / YangTextSchemaContextResolverTest.java
index 9d158ab7cdbb6ca7a0dcb3f19edc072d4d78f33f..6eff10919f85361bca413672119c7a640418e6d1 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.io.IOException;
 import java.net.URL;
@@ -22,7 +21,6 @@ import java.util.concurrent.ExecutionException;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
@@ -73,14 +71,14 @@ public class YangTextSchemaContextResolverTest {
         assertEquals(bazModuleId, baz.get().getIdentifier());
 
         final SourceIdentifier foobarModuleId = RevisionSourceIdentifier.create("foobar", "2016-09-26");
-        final CheckedFuture<YangTextSchemaSource, SchemaSourceException> foobar =
-                yangTextSchemaContextResolver.getSource(foobarModuleId);
+        final ListenableFuture<YangTextSchemaSource> foobar = yangTextSchemaContextResolver.getSource(foobarModuleId);
         assertTrue(foobar.isDone());
         try {
-            foobar.checkedGet();
+            foobar.get();
             fail("A MissingSchemaSourceException should have been thrown.");
-        } catch (MissingSchemaSourceException ex) {
-            assertEquals("URL for RevisionSourceIdentifier [name=foobar@2016-09-26] not registered", ex.getMessage());
+        } catch (ExecutionException e) {
+            assertEquals("URL for RevisionSourceIdentifier [name=foobar@2016-09-26] not registered",
+                e.getCause().getMessage());
         }
 
         Optional<SchemaContext> schemaContextOptional = yangTextSchemaContextResolver.getSchemaContext();