Defect fix for YANG revision
Change-Id: I6af5e82122629ea69c40b4fc3159bc7712d8293d
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java
index 8226442..2812a36 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/RevisionListenerTest.java
@@ -25,6 +25,7 @@
import java.io.IOException;
import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
/**
@@ -64,4 +65,14 @@
YangNode node = manager.getDataModel("src/test/resources/RevisionInValidOrder.yang");
}
+
+ /**
+ * Checks the revision with current date is created for empty revision statement.
+ */
+ @Test
+ public void processWithoutRevision() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/RevisionAbsence.yang");
+ assertThat(((YangModule) node).getRevision().getRevDate(), notNullValue());
+ }
}
\ No newline at end of file
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java
index c3028de..26d79f4 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/SubModuleListenerTest.java
@@ -26,6 +26,7 @@
import java.io.IOException;
import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.Assert.assertThat;
/**
@@ -107,6 +108,8 @@
assertThat(yangNode.getBelongsTo().getBelongsToModuleName(), is("ONOS"));
// Checks for the version value in data model tree.
assertThat(yangNode.getBelongsTo().getPrefix(), is("On1"));
+ //Checks the revision with current date is created for empty revision statement.
+ assertThat(((YangSubModule) node).getRevision().getRevDate(), notNullValue());
}
/**
diff --git a/utils/yangutils/src/test/resources/RevisionAbsence.yang b/utils/yangutils/src/test/resources/RevisionAbsence.yang
new file mode 100644
index 0000000..eb1d1d9
--- /dev/null
+++ b/utils/yangutils/src/test/resources/RevisionAbsence.yang
@@ -0,0 +1,5 @@
+module Test {
+yang-version 1;
+namespace urn:ietf:params:xml:ns:yang:ietf-ospf;
+prefix test;
+}