import static org.junit.Assert.assertEquals;\r
\r
import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
import java.io.IOException;\r
+import java.io.StringBufferInputStream;\r
\r
import org.junit.After;\r
import org.junit.Before;\r
*/\r
@Test\r
public void testReadLines() {\r
+ String fileName = "src/test/resources/workflow/template-test.bpmn20.xml";\r
+ File file = new File(fileName);\r
+ FileInputStream ins = null;\r
+ try {\r
+ ins = new FileInputStream(file);\r
+ String[] ss = FileCommonUtils.readLines(ins);\r
+ assertEquals(false, ss.length == 0);\r
+ \r
+ FileCommonUtils.write("template-test.bpmn20.xml", ss);\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ } finally {\r
+ FileCommonUtils.closeInputStream(ins);\r
+ }\r
+\r
}\r
\r
/**\r
*/\r
@Test\r
public void testSaveFile() {\r
+ String fileName = "test3.json";\r
+ String content = "{\"aaa\": \"节点\"}";\r
+ StringBufferInputStream ins = null;\r
+ try {\r
+ ins = new StringBufferInputStream(content);\r
+ FileCommonUtils.saveFile(ins, ".", fileName);\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ FileCommonUtils.closeInputStream(ins);\r
+ }\r
}\r
\r
/**\r