@Test public void fetchReportResult__support_does_use_result_as_is_when_empty() throws Exception { CheckmarxAdapterContext context = prepareContent(""); supportToTest.fetchReportResult(context); verify(context).setResult(""); }
void fetchReportResult(CheckmarxAdapterContext context) throws AdapterException { ReportDetails details = context.getReportDetails(); try { RestOperations restTemplate = context.getRestOperations(); ResponseEntity<String> queueData = restTemplate .getForEntity(context.getAPIURL("reports/sastScan/" + context.getReportId()), String.class); String body = queueData.getBody(); if (body == null) { body = ""; } int index = body.indexOf("<?xml"); if (index > 0) { body = body.substring(index); } context.setResult(body); } catch (HttpStatusCodeException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { details.notFound = true; return; } throw e; } }
CheckmarxScanReportSupport { void fetchReportResult(CheckmarxAdapterContext context) throws AdapterException { ReportDetails details = context.getReportDetails(); try { RestOperations restTemplate = context.getRestOperations(); ResponseEntity<String> queueData = restTemplate .getForEntity(context.getAPIURL("reports/sastScan/" + context.getReportId()), String.class); String body = queueData.getBody(); if (body == null) { body = ""; } int index = body.indexOf("<?xml"); if (index > 0) { body = body.substring(index); } context.setResult(body); } catch (HttpStatusCodeException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { details.notFound = true; return; } throw e; } } }
CheckmarxScanReportSupport { void fetchReportResult(CheckmarxAdapterContext context) throws AdapterException { ReportDetails details = context.getReportDetails(); try { RestOperations restTemplate = context.getRestOperations(); ResponseEntity<String> queueData = restTemplate .getForEntity(context.getAPIURL("reports/sastScan/" + context.getReportId()), String.class); String body = queueData.getBody(); if (body == null) { body = ""; } int index = body.indexOf("<?xml"); if (index > 0) { body = body.substring(index); } context.setResult(body); } catch (HttpStatusCodeException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { details.notFound = true; return; } throw e; } }  }
CheckmarxScanReportSupport { void fetchReportResult(CheckmarxAdapterContext context) throws AdapterException { ReportDetails details = context.getReportDetails(); try { RestOperations restTemplate = context.getRestOperations(); ResponseEntity<String> queueData = restTemplate .getForEntity(context.getAPIURL("reports/sastScan/" + context.getReportId()), String.class); String body = queueData.getBody(); if (body == null) { body = ""; } int index = body.indexOf("<?xml"); if (index > 0) { body = body.substring(index); } context.setResult(body); } catch (HttpStatusCodeException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { details.notFound = true; return; } throw e; } }  void startFetchReport(CheckmarxAdapterContext context); }
CheckmarxScanReportSupport { void fetchReportResult(CheckmarxAdapterContext context) throws AdapterException { ReportDetails details = context.getReportDetails(); try { RestOperations restTemplate = context.getRestOperations(); ResponseEntity<String> queueData = restTemplate .getForEntity(context.getAPIURL("reports/sastScan/" + context.getReportId()), String.class); String body = queueData.getBody(); if (body == null) { body = ""; } int index = body.indexOf("<?xml"); if (index > 0) { body = body.substring(index); } context.setResult(body); } catch (HttpStatusCodeException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { details.notFound = true; return; } throw e; } }  void startFetchReport(CheckmarxAdapterContext context);  }