summaryrefslogtreecommitdiffstats
path: root/model/utilities/src/test
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-05-30 09:48:40 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-05-30 16:29:30 +0100
commit8bad2ad828fad2f5f99a9a291ca0f5c51b62e4ca (patch)
tree7b02ec8dd5dcda881b9133169a753fc6671e44bf /model/utilities/src/test
parent55d93a12cc5575c872724f48585304b5eec77fea (diff)
Fixing Sonar bugs and code smells
Change-Id: I661cd409d01320fe11a29b7ea72b9e8f70e72a6c Issue-ID: POLICY-856 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
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);
-
+
}
}