@Override
    public String toString() {
        String contentTypeStr;
        if (contentType == null) {
            contentTypeStr = "unknown-content-type";
        } else {
            contentTypeStr = new String(contentType, StandardCharsets.UTF_8);
        }

        String valueStr;
        if (value == null) {
            valueStr = "value.length=0";
        } else if (contentTypeStr.contains("text")) {
            valueStr = "value=\"" + new String(value, StandardCharsets.UTF_8) + "\"";
        } else {
            valueStr = "value.length=" + value.length;
        }
        return "RestValue{"
                + "contentType='"
                + contentTypeStr
                + "', " + valueStr
                + '}';
    }
@Test
    public void testToString_withText() {
        byte[] value = stringToBytes("foobar");
        byte[] contentType = stringToBytes("text");

        restValue = new RestValue(value, contentType);

        assertContains(restValue.toString(), "contentType='text'");
        assertContains(restValue.toString(), "value=\"foobar\"");
    }