summaryrefslogtreecommitdiffstats
path: root/asdctool/src/test
diff options
context:
space:
mode:
authork.kazak <k.kazak@samsung.com>2019-05-29 14:50:05 +0200
committerOren Kleks <orenkle@amdocs.com>2019-06-03 05:56:58 +0000
commit8d52607c8fa8fd4dde5f9c3fec0a8c6ee7a4960d (patch)
tree307b6ea5910bf02a27205a7bea73b14318c79e7f /asdctool/src/test
parentf4f6b1407a836266ce7d98f33ee899d8a2377d83 (diff)
fix sonar: close resources
Use try-with-resources to close file data stream Fix tests for GraphJsonValidator Change-Id: I20931b4ef815abfb8da8ebd6242b765d0b02ef23 Issue-ID: SDC-2340 Signed-off-by: k.kazak@samsung.com
Diffstat (limited to 'asdctool/src/test')
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java10
-rw-r--r--asdctool/src/test/resources/graphError.json2
2 files changed, 8 insertions, 4 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
index ab6c49cdc9..06beb8d409 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphJsonValidatorTest.java
@@ -1,5 +1,8 @@
package org.openecomp.sdc.asdctool.impl;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import java.nio.file.NoSuchFileException;
@@ -18,6 +21,7 @@ public class GraphJsonValidatorTest {
// default test
testSubject = createTestSubject();
result = testSubject.verifyTitanJson("src/test/resources/graph.json");
+ assertTrue(result);
}
@Test
@@ -28,15 +32,15 @@ public class GraphJsonValidatorTest {
// default test
testSubject = createTestSubject();
result = testSubject.verifyTitanJson("src/test/resources/graphError.json");
+ assertFalse(result);
}
@Test(expected=NoSuchFileException.class)
public void testVerifyTitanJsonNoFile() throws Exception {
GraphJsonValidator testSubject;
- boolean result;
// default test
testSubject = createTestSubject();
- result = testSubject.verifyTitanJson("stam");
+ testSubject.verifyTitanJson("stam");
}
-} \ No newline at end of file
+}
diff --git a/asdctool/src/test/resources/graphError.json b/asdctool/src/test/resources/graphError.json
index a5a51d6693..9dcc9312f4 100644
--- a/asdctool/src/test/resources/graphError.json
+++ b/asdctool/src/test/resources/graphError.json
@@ -1 +1 @@
-"ERRRRORROROR{{{\"container\":zxcvfxcvxcvxc{\"accessContcxvxcvrolPolicyIDs\":[\"/in-cse/acp-7cxvxcvxcvx1663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":((\"cnt_900407520\",\"resourceTypeR\"RXCFV:\"int3\",\"stateTag\":0}}" \ No newline at end of file
+(("ERRRRORROROR{{{\"container\":zxcvfxcvxcvxc{\"accessContcxvxcvrolPolicyIDs\":[\"/in-cse/acp-7cxvxcvxcvx1663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":((\"cnt_900407520\",\"resourceTypeR\"RXCFV:\"int3\",\"stateTag\":0}}"