From 3d9ca52e4b034eba283a54b1c0fb0533b9f4ac4c Mon Sep 17 00:00:00 2001 From: talig Date: Tue, 2 Oct 2018 11:21:21 +0300 Subject: Fix exception throwing violation detected by sonar Change-Id: Iec96dbece79674741887dc39787e9e5520517836 Issue-ID: SDC-1806 Signed-off-by: talig --- .../java/org/onap/sdc/workflow/api/types/SortingTest.java | 15 ++++++++++++--- .../workflow/api/types/VersionStatesFormatterTest.java | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'workflow-designer-be/src/test') diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/SortingTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/SortingTest.java index 29436449..4aefad4f 100644 --- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/SortingTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/SortingTest.java @@ -18,10 +18,16 @@ public class SortingTest { @Test public void setSortInvalid() { - sorting.setSort("a"); + sorting.setSort("name:asc:a,:,"); assertEquals(Collections.emptyList(), sorting.getSorts()); } + @Test + public void setSortAscByDefault() { + sorting.setSort("name"); + assertEquals(Collections.singletonList(new Sort("name", true)), sorting.getSorts()); + } + @Test public void setSortAsc() { sorting.setSort("name:asc"); @@ -36,7 +42,10 @@ public class SortingTest { @Test public void setSortMoreThanOne() { - sorting.setSort("name:asc,date:desc"); - assertEquals(Arrays.asList(new Sort("name", true), new Sort("date", false)), sorting.getSorts()); + sorting.setSort("name:asc,type,date:desc"); + assertEquals(Arrays.asList( + new Sort("name", true), + new Sort("type", true), + new Sort("date", false)), sorting.getSorts()); } } \ No newline at end of file diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/VersionStatesFormatterTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/VersionStatesFormatterTest.java index c40aef3e..c4c6fbea 100644 --- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/VersionStatesFormatterTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/types/VersionStatesFormatterTest.java @@ -21,7 +21,7 @@ public class VersionStatesFormatterTest { @Test public void setVersionStateInvalid() { - versionStateSet.setVersionState("aaa"); + versionStateSet.setVersionState(",,a"); assertEquals(Collections.emptySet() ,versionStateSet.getVersionStates()); } -- cgit 1.2.3-korg