ST defect fixes and review comments fixes
Change-Id: Ib8c56a88c19cd9aa23918d0f9e37c89e74cb0d13
diff --git a/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java b/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
index cf1cf8d..22a8cac 100644
--- a/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
+++ b/src/test/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtilTest.java
@@ -16,22 +16,25 @@
package org.onosproject.yangutils.utils.io.impl;
+import static org.slf4j.LoggerFactory.getLogger;
+
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
-import org.onosproject.yangutils.translator.GeneratedFileType;
-import org.onosproject.yangutils.utils.UtilConstants;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import org.onosproject.yangutils.translator.GeneratedFileType;
+import org.onosproject.yangutils.utils.UtilConstants;
import org.slf4j.Logger;
-import static org.slf4j.LoggerFactory.getLogger;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+
/**
* Tests the file handle utilities.
@@ -50,12 +53,12 @@
/**
* A private constructor is tested.
*
- * @throws SecurityException if any security violation is observed.
- * @throws NoSuchMethodException if when the method is not found.
- * @throws IllegalArgumentException if there is illegal argument found.
- * @throws InstantiationException if instantiation is provoked for the private constructor.
- * @throws IllegalAccessException if instance is provoked or a method is provoked.
- * @throws InvocationTargetException when an exception occurs by the method or constructor.
+ * @throws SecurityException if any security violation is observed
+ * @throws NoSuchMethodException if when the method is not found
+ * @throws IllegalArgumentException if there is illegal argument found
+ * @throws InstantiationException if instantiation is provoked for the private constructor
+ * @throws IllegalAccessException if instance is provoked or a method is provoked
+ * @throws InvocationTargetException when an exception occurs by the method or constructor
*/
@Test
public void callPrivateConstructors() throws SecurityException, NoSuchMethodException, IllegalArgumentException,
@@ -82,17 +85,18 @@
* This test case checks the contents to be written in the file.
*/
@Test
- public void insertStringInFileTest() throws IOException {
+ public void updateFileHandleTest() throws IOException {
File dir = new File(baseDir + File.separator + "File1");
dir.mkdirs();
File createFile = new File(dir + "testFile");
createFile.createNewFile();
File createSourceFile = new File(dir + "sourceTestFile");
createSourceFile.createNewFile();
- FileSystemUtil.insertStringInFile(createFile, "This is to append a text to the file first1\n");
- FileSystemUtil.insertStringInFile(createFile, "This is next second line\n");
- FileSystemUtil.insertStringInFile(createFile, "This is next third line in the file");
+ FileSystemUtil.updateFileHandle(createFile, "This is to append a text to the file first1\n", false);
+ FileSystemUtil.updateFileHandle(createFile, "This is next second line\n", false);
+ FileSystemUtil.updateFileHandle(createFile, "This is next third line in the file", false);
FileSystemUtil.appendFileContents(createFile, createSourceFile);
+ FileSystemUtil.updateFileHandle(createFile, null, true);
}
/**