Skip to content

Commit f69a1a8

Browse files
Refactor execution result handling in Execution.java (#402)
* Refactor execution result handling in Execution.java * Add test for scan creation with async and debug flags in ScanTest.java --------- Co-authored-by: AlvoBen <[email protected]>
1 parent d532817 commit f69a1a8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/com/checkmarx/ast/wrapper/Execution.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static <T> T executeCommand(List<String> arguments,
6161
output.append(line).append(LINE_SEPARATOR);
6262
T parsedLine = lineParser.apply(line);
6363
if (parsedLine != null) {
64-
executionResult = customValidator.apply(arguments, parsedLine) ? parsedLine : null;
64+
executionResult = customValidator.apply(arguments, parsedLine) ? parsedLine : executionResult;
6565
}
6666
}
6767
process.waitFor();

src/test/java/com/checkmarx/ast/ScanTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ void testScanCreate() throws Exception {
7272
Assertions.assertEquals("Completed", wrapper.scanShow(UUID.fromString(scan.getId())).getStatus());
7373
}
7474

75+
@Test
76+
void testScanCreateWithAsyncAndDebugFlag_ShouldParseScanResponseSuccessfully() throws Exception {
77+
Map<String, String> params = commonParams();
78+
Scan scan = wrapper.scanCreate(params, "--debug --async");
79+
Assertions.assertNotNull(scan);
80+
}
81+
7582
@Test
7683
void testScanCancel() throws Exception {
7784
Map<String, String> params = commonParams();

0 commit comments

Comments
 (0)