aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/src/test/java
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2020-03-09 17:08:53 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-03-10 10:24:06 +0000
commit4f81700f5d8826d59164c4976a26631c2113e38f (patch)
tree1d08b45d33301647429eba7541bd1002686a8f13 /asdctool/src/test/java
parent0574f88247e18e830663802c2167df3166e1792b (diff)
Added new unit tests
Added new unit tests to GraphMLDataAnalyzer class. Fixed the Sonar issue. Issue-ID: SDC-2327 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Change-Id: I9a61dff2e9b0be1733de00b06c255abb8a3d5a8f
Diffstat (limited to 'asdctool/src/test/java')
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java45
1 files changed, 31 insertions, 14 deletions
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
index 7757b475bc..bffc0daee1 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/GraphMLDataAnalyzerTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,20 +22,37 @@ package org.openecomp.sdc.asdctool.impl;
import org.junit.Test;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.sdc.asdctool.impl.GraphMLDataAnalyzer.EXCEL_EXTENSION;
+import static org.openecomp.sdc.asdctool.impl.GraphMLDataAnalyzer.GRAPH_ML_EXTENSION;
+import static org.testng.AssertJUnit.assertNotNull;
+
public class GraphMLDataAnalyzerTest {
- private GraphMLDataAnalyzer createTestSubject() {
- return new GraphMLDataAnalyzer();
- }
+ public static final String FILE_NAME = "export";
+
+ @Test
+ public void testAnalyzeGraphMLDataNoFile() {
+ String[] args = new String[]{"noExistFile"};
+
+ // default test
+ GraphMLDataAnalyzer graph = new GraphMLDataAnalyzer();
+ String result = graph.analyzeGraphMLData(args);
+
+ assertNull(result);
+ }
+
+ @Test
+ public void testAnalyzeGraphMLData() {
+ String path = getClass().getClassLoader().getResource(FILE_NAME + GRAPH_ML_EXTENSION).getPath();
+ String[] args = new String[]{path};
- @Test
- public void testAnalyzeGraphMLData() throws Exception {
- GraphMLDataAnalyzer testSubject;
- String[] args = new String[] { "export", "src/main/resources/config/janusgraph.properties", "./" };
- String result;
+ // default test
+ GraphMLDataAnalyzer graph = new GraphMLDataAnalyzer();
+ String result = graph.analyzeGraphMLData(args);
- // default test
- testSubject = createTestSubject();
- result = testSubject.analyzeGraphMLData(args);
- }
+ assertNotNull(result);
+ assertTrue(result.endsWith(EXCEL_EXTENSION));
+ }
}