@Override protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext context) throws AssertionException { Map<String, String> checkMap = createCheckMap(context); List<AssertionError> assertionErrorList = new ArrayList<AssertionError>(); String response = messageExchange.getResponseContent(); Set<String> messages = new HashSet<String>(); try { for (String token : checkMap.keySet()) { boolean useRegexp = token.trim().startsWith(PREFIX); String description = !checkMap.get(token).equals("") ? checkMap.get(token) : token; if (useRegexp) { token = token.substring(token.indexOf(PREFIX) + 1); } String match = SecurityScanUtil.contains(context, response, token, useRegexp); if (match != null) { String message = description + " - Token [" + token + "] found [" + match + "]"; if (!messages.contains(message)) { assertionErrorList.add(new AssertionError(message)); messages.add(message); } } } } catch (Throwable e) { SoapUI.logError(e); } if (!messages.isEmpty()) { throw new AssertionException( assertionErrorList.toArray(new AssertionError[assertionErrorList.size()])); } return "OK"; }
public String internalAssertResponse(MessageExchange messageExchange, SubmitContext context) throws AssertionException { return assertContent(context, messageExchange.getResponseContent(), "Response"); }