X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FYangParserNegativeTest.java;h=72243324808b45bd74cb8adb009ad72152bf800b;hb=97a5221e31278c23e6364e9e8283d245af8f83d3;hp=29543ee044925e853727b1cb2bd8885f6d62f491;hpb=d8f0f2b146500275441ab8ba0cd2e1907f4b4ce4;p=yangtools.git diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java index 29543ee044..7224332480 100644 --- a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java +++ b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java @@ -10,6 +10,7 @@ package org.opendaylight.yangtools.yang.stmt; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import com.google.common.base.Throwables; import java.io.ByteArrayOutputStream; import java.io.File; @@ -23,8 +24,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException; +import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException; -import org.opendaylight.yangtools.yang.parser.spi.source.SourceException; import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream; public class YangParserNegativeTest { @@ -106,9 +107,9 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("SourceException should be thrown"); } - } catch (SourceException e) { - assertTrue(e.getMessage().contains("Error in module 'test4' in the refine of uses 'Relative{path=[" + - "(urn:simple.container.demo?revision=1970-01-01)node]}': can not perform refine of 'PRESENCE' for" + + } catch (ReactorException e) { + assertTrue(e.getCause().getMessage().contains("Error in module 'test4' in the refine of uses " + + "'Relative{path=[(urn:simple.container.demo?revision=1970-01-01)node]}': can not perform refine of 'PRESENCE' for" + " the target 'LEAF_LIST'.")); } } @@ -121,8 +122,8 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("YangParseException should be thrown"); } - } catch (SourceException e) { - assertTrue(e.getMessage().contains("Invalid length constraint: <4, 10>")); + } catch (ReactorException e) { + assertTrue(e.getCause().getMessage().contains("Invalid length constraint: <4, 10>")); } } @@ -134,8 +135,8 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("Exception should be thrown"); } - } catch (SourceException e) { - assertTrue(e.getMessage().contains("Invalid range constraint: <5, 20>")); + } catch (ReactorException e) { + assertTrue(e.getCause().getMessage().contains("Invalid range constraint: <5, 20>")); } } @@ -147,11 +148,11 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("SourceException should be thrown"); } - } catch (SourceException e) { + } catch (ReactorException e) { String expected = "Error in module 'container': cannot add '(urn:simple.container" + ".demo?revision=1970-01-01)foo'. Node name collision: '(urn:simple.container" + ".demo?revision=1970-01-01)foo' already declared."; - assertTrue(e.getMessage().contains(expected)); + assertTrue(e.getCause().getMessage().contains(expected)); } } @@ -163,11 +164,11 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("SourceException should be thrown"); } - } catch (SourceException e) { + } catch (ReactorException e) { String expected = "Error in module 'container-list': cannot add '(urn:simple.container" + ".demo?revision=1970-01-01)foo'. Node name collision: '(urn:simple.container" + ".demo?revision=1970-01-01)foo' already declared."; - assertTrue(e.getMessage().contains(expected)); + assertTrue(e.getCause().getMessage().contains(expected)); } } @@ -179,11 +180,11 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("SourceException should be thrown"); } - } catch (SourceException e) { + } catch (ReactorException e) { String expected = "Error in module 'container-leaf': cannot add '(urn:simple.container" + ".demo?revision=1970-01-01)foo'. Node name collision: '(urn:simple.container" + ".demo?revision=1970-01-01)foo' already declared."; - assertTrue(e.getMessage().contains(expected)); + assertTrue(e.getCause().getMessage().contains(expected)); } } @@ -195,11 +196,11 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream); fail("SourceException should be thrown"); } - } catch (SourceException e) { + } catch (ReactorException e) { String expected = "Error in module 'typedef': cannot add '(urn:simple.container" + ".demo?revision=1970-01-01)int-ext'. Node name collision: '(urn:simple.container" + ".demo?revision=1970-01-01)int-ext' already declared."; - assertTrue(e.getMessage().startsWith(expected)); + assertTrue(e.getCause().getMessage().startsWith(expected)); } } @@ -248,10 +249,10 @@ public class YangParserNegativeTest { TestUtils.loadModule(stream1); fail("InferenceException should be thrown"); } - } catch (InferenceException e) { + } catch (ReactorException e) { String expected = "Key 'rib-id' misses node 'rib-id' in list '(invalid:list:key:def?revision=1970-01-01)" + "application-map'"; - assertTrue(e.getMessage().startsWith(expected)); + assertTrue(e.getCause().getMessage().startsWith(expected)); } }