[ONOS-5142] Defect fix
Change-Id: Id01634505630179aa4605b76c5d2be4b947b5dac
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
index 73f9c0a..11c1818 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
@@ -209,5 +209,28 @@
deleteDirectory("target/unionTranslator/");
}
+ /**
+ * Unit test case to test Union with binary type.
+ *
+ * @throws IOException when fails to do IO operations
+ * @throws MojoExecutionException when fails to do mojo operations
+ */
+ @Test
+ public void processUnionWithBinaryTypes() throws IOException,
+ MojoExecutionException {
+ String searchDir = "src/test/resources/unionTranslator/unionwithbinary";
+ YangUtilManager utilManager = new YangUtilManager();
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangPluginConfig yangPluginConfig = new YangPluginConfig();
+ yangPluginConfig.setCodeGenDir("target/unionTranslator/");
+
+ utilManager.translateToJava(yangPluginConfig);
+ deleteDirectory("target/unionTranslator/");
+ }
+
// TODO enhance the test cases, after having a framework of translator test.
}
diff --git a/plugin/src/test/resources/unionTranslator/unionwithbinary/test.yang b/plugin/src/test/resources/unionTranslator/unionwithbinary/test.yang
new file mode 100644
index 0000000..d2c9966
--- /dev/null
+++ b/plugin/src/test/resources/unionTranslator/unionwithbinary/test.yang
@@ -0,0 +1,15 @@
+module moduletest {
+ yang-version 1;
+ namespace "onos-yang-20:level1:newlevel";
+ prefix test;
+ organization "huawei";
+ contact "adarsh.m@huawei.com";
+ description "leaf scenario";
+ revision 2015-02-05;
+ leaf eleven {
+ type union {
+ type binary;
+ type int8;
+ }
+ }
+}