private void assertTextPayload(RestTest restTest, com.jcabi.http.Response response) {
        InputStream inputStream = null;
        try {
            inputStream = new ByteArrayInputStream(response.binary());
            List<String> lines = IOUtils.readLines(inputStream);
            StringBuilder builder = new StringBuilder();
            for (String line : lines) {
                // Replace single backslashes with double backslashes to escape them for the regex compiler.
                // These occur for example in Windows paths
                builder.append(line.replace("\\","\\\\")).append("\n");
            }

            String actual = builder.toString();
            String expected = restTest.getExpectedResponsePayload();

            // If Regex-Match header set on the request, we use this to signify that we want regex matching.
            boolean regexMatchMod = BooleanUtils.toBoolean(testMetaHeaders.get("X-RestTest-RegexMatching"));
            if (expected != null) {
                if (regexMatchMod) {
                    assertThat(actual)
                        .withFailMessage("Response payload (text/plain) mismatch. Expected: <%s> but was: <%s>", expected, actual)
                        .matches(expected);
                } else {
                    assertThat(actual).isEqualTo(expected);
                }
            }
        } catch (Exception e) {
            throw new Error(e);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    }
Assume the payload is Text and do some assertions based on the configuration in the REST
Test.

@param restTest
@param response
test/common/src/main/java/io/apiman/test/common/util/TestPlanRunner.java