diff options
author | YuanHu <yuan.hu1@zte.com.cn> | 2018-03-14 17:04:05 +0800 |
---|---|---|
committer | YuanHu <yuan.hu1@zte.com.cn> | 2018-03-14 17:04:05 +0800 |
commit | 9d5b872a75cdfcad2a97a702e56a46730a653734 (patch) | |
tree | fffc9e1bda377f106162d44a8f1ebdc6530567e2 /sdc-workflow-designer-server/src/test | |
parent | 56612b4a3ecc19481e5a3e9d1edb202a3a726066 (diff) |
Clean up Redundant Code
Clean up Redundant Code and Add Code Optimization.
Issue-ID: SDC-1078
Change-Id: Ic6d03acf811df443c02df1753ea95aa4bf36da62
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src/test')
-rw-r--r-- | sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java | 241 |
1 files changed, 145 insertions, 96 deletions
diff --git a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java index 9a49b29e..a9770de0 100644 --- a/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java +++ b/sdc-workflow-designer-server/src/test/java/org/onap/sdc/workflowdesigner/utils/FileCommonUtilsTest.java @@ -1,96 +1,145 @@ -/** - * Copyright (c) 2018 ZTE Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the Apache License, Version 2.0 - * and the Eclipse Public License v1.0 which both accompany this distribution, - * and are available at http://www.eclipse.org/legal/epl-v10.html - * and http://www.apache.org/licenses/LICENSE-2.0 - * - * Contributors: - * ZTE - initial API and implementation and/or initial documentation - */ - -package org.onap.sdc.workflowdesigner.utils; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.IOException; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * - */ -public class FileCommonUtilsTest { - - /** - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception {} - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception {} - - /** - * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#readString(String)} - * - */ - @Test - public final void readStringString() { - String fileName = "src\\test\\resources\\workflow\\template-test.bpmn20.xml"; - File file = new File(fileName); - if (file.exists()) { - try { - String s = FileCommonUtils.readString(fileName); - FileCommonUtils.write("test.xml", s); - assertEquals(s.isEmpty(), false); - } catch (IOException e) { - } - } - } - - - /** - * Test method for - * {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(String, String)} - * - */ - @Test - public final void writeStringString() { - String fileName = "test.json"; - String content = "{\"aaa\": \"节点\"}"; - - try { - FileCommonUtils.write(fileName, content); - String s = FileCommonUtils.readString(fileName); - assertEquals(s, content); - } catch (IOException e) { - } - } - - /** - * Test method for - * {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#writetoAbsoluteFile(String, String, String)} - * - */ - @Test - public final void saveFileStringStringString() { - String fileName = "test1.json"; - String content = "{\"aaa\": \"节点\"}"; - - try { - FileCommonUtils.writetoAbsoluteFile(".", fileName, content); - String s = FileCommonUtils.readString(fileName); - assertEquals(s, content); - } catch (IOException e) { - } - } - -} +/**
+ * Copyright (c) 2017-2018 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the Apache License, Version 2.0
+ * and the Eclipse Public License v1.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * ZTE - initial API and implementation and/or initial documentation
+ */
+package org.onap.sdc.workflowdesigner.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class FileCommonUtilsTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {}
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {}
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#readLines(java.io.InputStream)}.
+ */
+ @Test
+ public void testReadLines() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#readString(java.io.InputStream)}.
+ */
+ @Test
+ public void testReadStringInputStream() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#readString(java.lang.String)}.
+ */
+ @Test
+ public void testReadStringString() {
+ String fileName = "src\\test\\resources\\workflow\\template-test.bpmn20.xml";
+ File file = new File(fileName);
+ if (file.exists()) {
+ try {
+ String s = FileCommonUtils.readString(fileName);
+ FileCommonUtils.write("test.xml", s);
+ assertEquals(s.isEmpty(), false);
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#saveFile(java.io.InputStream, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testSaveFile() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#writetoAbsoluteFile(java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testWritetoAbsoluteFileStringStringString() {
+ String fileName = "test1.json";
+ String content = "{\"aaa\": \"节点\"}";
+
+ try {
+ FileCommonUtils.writetoAbsoluteFile(".", fileName, content);
+ String s = FileCommonUtils.readString(fileName);
+ assertEquals(s, content);
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#writetoAbsoluteFile(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testWritetoAbsoluteFileStringStringStringString() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testWriteStringString() {
+ String fileName = "test.json";
+ String content = "{\"aaa\": \"节点\"}";
+
+ try {
+ FileCommonUtils.write(fileName, content);
+ String s = FileCommonUtils.readString(fileName);
+ assertEquals(s, content);
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testWriteStringStringStringString() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(java.lang.String, java.lang.String, java.lang.String)}.
+ */
+ @Test
+ public void testWriteStringStringString() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(java.lang.String, java.lang.String[])}.
+ */
+ @Test
+ public void testWriteStringStringArray() {
+ }
+
+ /**
+ * Test method for {@link org.onap.sdc.workflowdesigner.utils.FileCommonUtils#write(java.lang.String, java.lang.String[], java.lang.String)}.
+ */
+ @Test
+ public void testWriteStringStringArrayString() {
+ }
+
+}
|