YANG sub module linking + unsupported yang construct + defect fix
Change-Id: I224c8c14ee2111f6844278cb540c48651544f59b
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
index 6f13667..a78c65f 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/EnumListenerTest.java
@@ -18,7 +18,10 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
+
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangEnum;
import org.onosproject.yangutils.datamodel.YangEnumeration;
@@ -38,6 +41,9 @@
*/
public class EnumListenerTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
private final YangUtilsParserManager manager = new YangUtilsParserManager();
/**
@@ -84,7 +90,28 @@
*/
@Test(expected = ParserException.class)
public void processEnumWithDuplicateName() throws IOException, ParserException {
-
YangNode node = manager.getDataModel("src/test/resources/EnumWithDuplicateName.yang");
}
+
+ /**
+ * Checks enum boundary value.
+ */
+ @Test
+ public void processEnumBoundaryValue() throws IOException, ParserException {
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : value value 21474836472147483647 is not valid.");
+ YangNode node = manager.getDataModel("src/test/resources/EnumBoundaryValue.yang");
+ }
+
+ /**
+ * Checks whether exception is thrown if value is not specified following max enum value.
+ */
+ @Test
+ public void processEnumMaxNextValue() throws IOException, ParserException {
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : "
+ + "An enum value MUST be specified for enum substatements following the one"
+ + "with the current highest value");
+ YangNode node = manager.getDataModel("src/test/resources/EnumMaxNextValue.yang");
+ }
}