[ONOS-4352]Defect fix for unsupported types.
Change-Id: I5c1425518422492de8e108c54ea82f0c85812157
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
index 1737ea6..1b6a7c6 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
@@ -17,7 +17,9 @@
import java.io.IOException;
import java.util.ListIterator;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
@@ -35,6 +37,9 @@
*/
public class TypeListenerTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
private final YangUtilsParserManager manager = new YangUtilsParserManager();
/**
@@ -114,4 +119,46 @@
assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
}
+
+ /**
+ * Checks for unsupported type leafref.
+ */
+ @Test
+ public void processLeafrefType() throws IOException, ParserException {
+
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : \"leafref\" is not supported in current version,"
+ + " please check wiki for YANG utils road map.");
+
+ YangNode node = manager
+ .getDataModel("src/test/resources/LeafrefInvalidIdentifier.yang");
+ }
+
+ /**
+ * Checks for unsupported type identityref.
+ */
+ @Test
+ public void processIdentityrefType() throws IOException, ParserException {
+
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : \"identityref\" is not supported in current version,"
+ + " please check wiki for YANG utils road map.");
+
+ YangNode node = manager
+ .getDataModel("src/test/resources/IdentityrefInvalidIdentifier.yang");
+ }
+
+ /**
+ * Checks for unsupported type instance identifier.
+ */
+ @Test
+ public void processInstanceIdentifierType() throws IOException, ParserException {
+
+ thrown.expect(ParserException.class);
+ thrown.expectMessage("YANG file error : \"instance-identifier\" is not supported in current version,"
+ + " please check wiki for YANG utils road map.");
+
+ YangNode node = manager
+ .getDataModel("src/test/resources/InstanceIdentifierInvalidIdentifier.yang");
+ }
}