From f1de4f971558a959482cbbc248e0793b4e1d7913 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 24 Feb 2022 16:50:11 +0000 Subject: [PATCH 1/3] use query name instead of display name when grouping --- .../src/com/checkmarx/eclipse/views/DataProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/DataProvider.java b/checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/DataProvider.java index 042919b9..18a1f845 100644 --- a/checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/DataProvider.java +++ b/checkmarx-ast-eclipse-plugin/src/com/checkmarx/eclipse/views/DataProvider.java @@ -467,7 +467,7 @@ private List groupByQueryName(List vulnerabilities){ Map> filteredByQueryName = new HashMap<>(); for (DisplayModel vulnerability : vulnerabilities) { - String queryName = vulnerability.getName(); + String queryName = vulnerability.getQueryName(); if (filteredByQueryName.containsKey(queryName)) { filteredByQueryName.get(queryName).add(vulnerability); } else { From df456b102e779fc51d2d06eace0989db85578932 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Fri, 25 Feb 2022 10:21:34 +0000 Subject: [PATCH 2/3] add message showing the actual value when assert fails --- .../test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestUI.java b/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestUI.java index 6fd78c7d..0fa3fb31 100644 --- a/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestUI.java +++ b/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestUI.java @@ -93,7 +93,7 @@ public void testMissingSetCheckmarxServerUrl() throws TimeoutException { sleep(); // After a sleep the missing Server Url message must be displayed - assertEquals(ERROR_SERVER_URL_NOT_SET, _bot.tree().cell(0, 0)); + assertEquals( _bot.tree().cell(0, 0), ERROR_SERVER_URL_NOT_SET, _bot.tree().cell(0, 0)); // Close Checkmarx AST Scan view _bot.viewByTitle(VIEW_CHECKMARX_AST_SCAN).close(); From 31db1f7c69dc594ee32ed06cac966e4ccda29c06 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Fri, 25 Feb 2022 10:58:16 +0000 Subject: [PATCH 3/3] reflect query group name changes in the tests --- .../ast/eclipse/plugin/tests/ui/TestTriage.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestTriage.java b/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestTriage.java index 135a9de6..cd7c9676 100644 --- a/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestTriage.java +++ b/checkmarx-ast-eclipse-plugin-tests/src/test/java/checkmarx/ast/eclipse/plugin/tests/ui/TestTriage.java @@ -85,15 +85,11 @@ public void testTriage() throws TimeoutException { // wait for button to be enabled _bot.waitUntil(triageButtonEnabled); - - - // check the first result is again the selected one after the revert - - //assertEquals(resultName, getFirstToVerifyResultNode().getText()); // since the order of the list changes, we need to make sure that the changed result is in HIGH -> TO_VERIFY nodes - List stateResults = getStateResultNodes("TO_VERIFY").stream().map(element -> (element.split(" ")[0] +" " +element.split(" ")[1]).trim()).collect(Collectors.toList()); - assertTrue(stateResults.contains(resultName)); + // split(" ")[0] provides the initial part of the name, which is the query id, both in the group and in resultName + List stateResults = getStateResultNodes("TO_VERIFY").stream().map(element -> (element.split(" ")[0]).trim()).collect(Collectors.toList()); + assertTrue(String.format("%s - %s", stateResults.toString(), resultName), stateResults.contains(resultName.split(" ")[0])); // open changes tab SWTBotTabItem changesTab = _bot.tabItemWithId(PluginConstants.CHANGES_TAB_ID); changesTab.activate();