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 / SemanticVersionBorderCaseTest.java
index 028989ce9b264447f93164b17fdd4f5bab2a11bb..86428b70f3c3fa652f79c443c4d4963099e020f1 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;
@@ -21,7 +19,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.model.api.Module;
 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;
@@ -86,8 +84,8 @@ public class SemanticVersionBorderCaseTest {
             StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-major",
                     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(5.5.5)]."));
         }
     }
@@ -99,8 +97,8 @@ public class SemanticVersionBorderCaseTest {
             StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-minor",
                     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(5.5.5)]."));
         }
     }
@@ -112,8 +110,8 @@ public class SemanticVersionBorderCaseTest {
             StmtTestUtils.parseYangSources("/semantic-version/border-case/border-case-invalid-patch",
                     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(5.5.5)]."));
         }
     }