### Question:
BindPartIdsAndETagsToRequest implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Map!"); checkNotNull(request, "request"); Map<Integer, String> map = (Map<Integer, String>) input; checkArgument(!map.isEmpty(), "Please send parts"); StringBuilder content = new StringBuilder(); content.append("<CompleteMultipartUpload>"); for (Entry<Integer, String> entry : map.entrySet()) { content.append("<Part>"); content.append("<PartNumber>").append(entry.getKey()).append("</PartNumber>"); content.append("<ETag>").append(entry.getValue()).append("</ETag>"); content.append("</Part>"); } content.append("</CompleteMultipartUpload>"); Payload payload = Payloads.newStringPayload(content.toString()); payload.getContentMetadata().setContentType(MediaType.TEXT_XML); request.setPayload(payload); return request; }  @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input);  }### Answer:
@Test public void testPassWithMinimumDetailsAndPayload5GB() { HttpRequest request = HttpRequest.builder().method("PUT").endpoint("http: Payload payload = Payloads .newStringPayload("<CompleteMultipartUpload><Part><PartNumber>1</PartNumber><ETag>\"a54357aff0632cce46d942af68356b38\"</ETag></Part></CompleteMultipartUpload>"); payload.getContentMetadata().setContentType(MediaType.TEXT_XML); request = binder.bindToRequest(request, ImmutableMap.<Integer, String> of(1, "\"a54357aff0632cce46d942af68356b38\"")); assertEquals(request.getPayload().getRawContent(), payload.getRawContent()); assertEquals(request, HttpRequest.builder().method("PUT").endpoint("http: payload).build()); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyIsBad() { HttpRequest request = HttpRequest.builder().method("PUT").endpoint("http: binder.bindToRequest(request, ImmutableMap.<Integer, String> of()); }
@Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class }) public void testNullIsBad() { BindMapToHeadersWithPrefix binder = new BindMapToHeadersWithPrefix("prefix:"); HttpRequest request = HttpRequest.builder().method("GET").endpoint("http: binder.bindToRequest(request, null); }