YANG construct collision detection framework added
Change-Id: I1458f9e3192641f3f90c444798c31a64536ffa5d
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
index df8f385..40afc03 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
@@ -120,7 +120,7 @@
@Test
public void processLeafConfigInvalidCardinality() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Invalid cardinality in config before processing.");
+ thrown.expectMessage("YANG file error: Invalid cardinality of config in leaf \"invalid-interval\".");
YangNode node = manager.getDataModel("src/test/resources/LeafConfigInvalidCardinality.yang");
}
@@ -131,7 +131,7 @@
@Test
public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException {
thrown.expect(ParserException.class);
- thrown.expectMessage("Internal parser error detected: Invalid cardinality in mandatory before processing.");
+ thrown.expectMessage("YANG file error: Invalid cardinality of mandatory in leaf \"invalid-interval\".");
YangNode node = manager.getDataModel("src/test/resources/LeafMandatoryInvalidCardinality.yang");
}
@@ -173,6 +173,33 @@
}
/**
+ * Checks duplicate leaf statement as sub-statement of module.
+ */
+ @Test(expected = ParserException.class)
+ public void processModuleWithDuplicateLeaf() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/ModuleWithDuplicateLeaf.yang");
+ }
+
+ /**
+ * Checks duplicate leaf statement as sub-statement of container.
+ */
+ @Test(expected = ParserException.class)
+ public void processContainerWithDuplicateLeaf() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/ContainerWithDuplicateLeaf.yang");
+ }
+
+ /**
+ * Checks duplicate leaf statement as sub-statement of list.
+ */
+ @Test(expected = ParserException.class)
+ public void processListWithDuplicateLeaf() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/ListWithDuplicateLeaf.yang");
+ }
+
+ /**
* Checks leaf statement as sub-statement of list.
*/
@Test
@@ -207,4 +234,4 @@
assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
assertThat(leafInfo.getReference(), is("\"RFC 6020\""));
}
-}
\ No newline at end of file
+}