use of com.checkmarx.flow.exception.ExitThrowable in project cx-flow by checkmarx-ltd.
the class SastCliSteps method checkReturnCode.
@Then("cxflow should exit with exit code: {}")
public void checkReturnCode(int expectedExitCode) {
Throwable exception = testContext.getCxFlowExecutionException();
Assert.assertNotNull("Expected an exception to be thrown.", exception);
Assert.assertEquals(InvocationTargetException.class, exception.getClass());
Throwable targetException = ((InvocationTargetException) exception).getTargetException();
Assert.assertTrue(targetException instanceof ExitThrowable);
int actualExitCode = ((ExitThrowable) targetException).getExitCode();
Assert.assertEquals("The expected exist code did not match", expectedExitCode, actualExitCode);
}
use of com.checkmarx.flow.exception.ExitThrowable in project cx-flow by checkmarx-ltd.
the class ScaCliSteps method validateExitCode.
@Then("run should exit with exit code {}")
public void validateExitCode(int expectedExitCode) {
Assert.assertNotNull("Expected an exception to be thrown.", cxFlowExecutionException);
Assert.assertEquals(InvocationTargetException.class, cxFlowExecutionException.getClass());
Throwable targetException = ((InvocationTargetException) cxFlowExecutionException).getTargetException();
Assert.assertTrue(targetException instanceof ExitThrowable);
int actualExitCode = ((ExitThrowable) targetException).getExitCode();
Assert.assertEquals("The expected exit code did not match", expectedExitCode, actualExitCode);
}
use of com.checkmarx.flow.exception.ExitThrowable in project cx-flow by checkmarx-ltd.
the class PublishingSteps method publishingTheReport.
@When("^publishing (?:the|a SAST) report$")
public void publishingTheReport() throws Exception, ExitThrowable {
ScanRequest request = prepareScanRequest();
String sastReportPath = Paths.get(Constants.SAMPLE_SAST_RESULTS_DIR, sastReportFilename).toString();
File sastReport = TestUtils.getFileFromResource(sastReportPath);
try {
sastScanner.cxParseResults(request, sastReport);
} catch (Throwable e) {
if (expectingException) {
lastCxFlowException = e;
} else {
throw e;
}
}
}
Aggregations