@Test public void test() { HttpResponse response = HttpResponse.builder().statusCode(200).payload( Payloads.newInputStreamPayload(getClass().getResourceAsStream("/complete-multipart-upload.xml"))) .build(); ETagFromHttpResponseViaRegex parser = new ETagFromHttpResponseViaRegex(new ReturnStringIf2xx()); assertEquals(parser.apply(response), "\"3858f62230ac3c915f300c664312c11f-9\""); }
@Override public String apply(HttpResponse response) { String value = null; String content = returnStringIf200.apply(response); if (content != null) { Matcher matcher = PATTERN.matcher(content); if (matcher.find()) { value = matcher.group(1); if (value.indexOf(ESCAPED_QUOTE) != -1) { value = value.replace(ESCAPED_QUOTE, "\""); } } } return value; }
ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> { @Override public String apply(HttpResponse response) { String value = null; String content = returnStringIf200.apply(response); if (content != null) { Matcher matcher = PATTERN.matcher(content); if (matcher.find()) { value = matcher.group(1); if (value.indexOf(ESCAPED_QUOTE) != -1) { value = value.replace(ESCAPED_QUOTE, "\""); } } } return value; } }
ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> { @Override public String apply(HttpResponse response) { String value = null; String content = returnStringIf200.apply(response); if (content != null) { Matcher matcher = PATTERN.matcher(content); if (matcher.find()) { value = matcher.group(1); if (value.indexOf(ESCAPED_QUOTE) != -1) { value = value.replace(ESCAPED_QUOTE, "\""); } } } return value; } @Inject  ETagFromHttpResponseViaRegex(ReturnStringIf2xx returnStringIf200); }
ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> { @Override public String apply(HttpResponse response) { String value = null; String content = returnStringIf200.apply(response); if (content != null) { Matcher matcher = PATTERN.matcher(content); if (matcher.find()) { value = matcher.group(1); if (value.indexOf(ESCAPED_QUOTE) != -1) { value = value.replace(ESCAPED_QUOTE, "\""); } } } return value; } @Inject  ETagFromHttpResponseViaRegex(ReturnStringIf2xx returnStringIf200); @Override String apply(HttpResponse response); }
ETagFromHttpResponseViaRegex implements Function<HttpResponse, String> { @Override public String apply(HttpResponse response) { String value = null; String content = returnStringIf200.apply(response); if (content != null) { Matcher matcher = PATTERN.matcher(content); if (matcher.find()) { value = matcher.group(1); if (value.indexOf(ESCAPED_QUOTE) != -1) { value = value.replace(ESCAPED_QUOTE, "\""); } } } return value; } @Inject  ETagFromHttpResponseViaRegex(ReturnStringIf2xx returnStringIf200); @Override String apply(HttpResponse response);  }