diff options
author | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-05-05 09:36:31 +0000 |
---|---|---|
committer | priyanka.akhade <priyanka.akhade@huawei.com> | 2020-05-06 09:54:31 +0000 |
commit | 43daaf01499ac80d52187507e50f6ce7c5ce6026 (patch) | |
tree | 942a431f8d2e18de7394549a7c4f0ea124b06da4 /validate | |
parent | 19684879f5742847e2e903d6c039de7e13fab6e3 (diff) |
sonar bug fix- conditional operation returns the same value whether the condition is "true" or "false"
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com>
Issue-ID: CLI-270
Change-Id: I500b47559bba7b8cf366f70357041c4c516b8f90
Diffstat (limited to 'validate')
2 files changed, 7 insertions, 2 deletions
diff --git a/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java b/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java index 37c51401..bc8f456e 100644 --- a/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java +++ b/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java @@ -61,8 +61,7 @@ public class SampleYamlGenerator { writer.write(" |\n"); nTab++; String[] lines = value.split("\n"); - long skipLines = debug ? 0 : 0; - Arrays.stream(lines).skip(skipLines ).forEach(line -> writer.write(printTabs() + line + "\n")); // NOSONAR + Arrays.stream(lines).forEach(line -> writer.write(printTabs() + line + "\n")); // NOSONAR } private static String printTabs() { diff --git a/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java b/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java index cd395833..dc99df02 100644 --- a/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java +++ b/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java @@ -28,5 +28,11 @@ public class SampleYamlGeneratorTest { SampleYamlGenerator.generateSampleYaml("testcmd", Arrays.asList("-a", "argument"), "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false, "sample1"); } + @Test + public void testGenerateSampleYamlForWriteMultilineKeyValue() throws IOException { + SampleYamlGenerator.generateSampleYaml("testcmd-multiline", Arrays.asList("-a", "argument"), + "+--------+\n+testval1 +\n+argument1+\n+testval2 +\n+argument2+", "test-version-1.0", + "target/test-multiline.yaml", true, "sample1"); + } } |