Bug 6244: Add context to exceptions thrown by yang statement parser
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / semver / SemanticVersionMultipleImportTest.java
index 7b85f55afa8b6f8a8176865f9fb1130d979b0eaf..6264b8f56ed8c9581810615fe90cf5b0a4e4ccdd 100644 (file)
@@ -12,8 +12,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
-
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -23,7 +21,7 @@ import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
@@ -37,8 +35,8 @@ public class SemanticVersionMultipleImportTest {
             StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-invalid-deprecated",
                     StatementParserMode.SEMVER_MODE);
             fail("Test should fail due to invalid semantic version");
-        } catch (InferenceException e) {
-            assertTrue(e.getMessage()
+        } catch (ReactorException e) {
+            assertTrue(e.getCause().getMessage()
                     .startsWith("Unable to find module compatible with requested import [bar(1.0.0)]."));
         }
     }
@@ -50,8 +48,8 @@ public class SemanticVersionMultipleImportTest {
             StmtTestUtils.parseYangSources("/semantic-version/multiple/multiple-invalid-nosufficient",
                     StatementParserMode.SEMVER_MODE);
             fail("Test should fail due to invalid semantic version");
-        } catch (InferenceException e) {
-            assertTrue(e.getMessage()
+        } catch (ReactorException e) {
+            assertTrue(e.getCause().getMessage()
                     .startsWith("Unable to find module compatible with requested import [bar(2.5.5)]."));
         }
     }