public void checkContentRegexp()

in src/main/java/org/apache/sling/testing/clients/SlingHttpResponse.java [116:134]


    public void checkContentRegexp(String... regexp) throws TestingValidationException {
        for(String expr : regexp) {
            final Pattern p = Pattern.compile(".*" + expr + ".*");
            boolean matched = false;
            try (final Scanner scanner = new Scanner(this.getContent())) {
                while (scanner.hasNextLine()) {
                    String line = scanner.nextLine();
                    if (p.matcher(line).matches()) {
                        matched = true;
                        break;
                    }
                }
            }

            if (!matched) {
                throw new TestingValidationException("Pattern " + p + " didn't match any line in content. Content is: \n\n" + getContent());
            }
        }
    }