summaryrefslogtreecommitdiffstats
path: root/model/utilities/src/test
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-05-30 22:51:02 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-30 22:51:02 +0000
commit8eefbb9e55dfbab447e2495312af6aa81a51eb6e (patch)
tree8e29c4042d4001050a985d47b6d62da30a95af02 /model/utilities/src/test
parent10d58cde1f75ea0ddf0cdc0746d858e0a077980d (diff)
parent8bad2ad828fad2f5f99a9a291ca0f5c51b62e4ca (diff)
Merge "Fixing Sonar bugs and code smells"
Diffstat (limited to 'model/utilities/src/test')
-rw-r--r--model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java
index 4e5cba374..c84ee8618 100644
--- a/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java
+++ b/model/utilities/src/test/java/org/onap/policy/apex/model/utilities/TextFileUtilsTest.java
@@ -1,4 +1,4 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* ================================================================================
@@ -27,26 +27,27 @@ import java.io.FileInputStream;
import java.io.IOException;
import org.junit.Test;
-import org.onap.policy.apex.model.utilities.TextFileUtils;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TextFileUtilsTest {
+ private static final String FILE_CONTENT = "This is the contents of a text file";
+
@Test
public void test() throws IOException {
- File tempTextFile = File.createTempFile("Test", "txt");
-
- TextFileUtils.putStringAsTextFile("This is the contents of a text file", tempTextFile.getAbsolutePath());
-
- String textFileString0 = TextFileUtils.getTextFileAsString(tempTextFile.getAbsolutePath());
- assertEquals("This is the contents of a text file", textFileString0);
-
- FileInputStream fis = new FileInputStream(tempTextFile);
- String textFileString1 = TextFileUtils.getStreamAsString(fis);
+ final File tempTextFile = File.createTempFile("Test", "txt");
+
+ TextFileUtils.putStringAsTextFile(FILE_CONTENT, tempTextFile.getAbsolutePath());
+
+ final String textFileString0 = TextFileUtils.getTextFileAsString(tempTextFile.getAbsolutePath());
+ assertEquals(FILE_CONTENT, textFileString0);
+
+ final FileInputStream fis = new FileInputStream(tempTextFile);
+ final String textFileString1 = TextFileUtils.getStreamAsString(fis);
assertEquals(textFileString0, textFileString1);
-
+
}
}