### Question:
BindIterableAsPayloadToDeleteRequest implements Binder { @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input is null") instanceof Iterable, "this binder is only valid for an Iterable"); checkNotNull(request, "request is null"); Iterable<String> keys = (Iterable<String>) input; checkArgument(!Iterables.isEmpty(keys), "The list of keys should not be empty."); String content; try { XMLBuilder rootBuilder = XMLBuilder.create("Delete"); for (String key : keys) { XMLBuilder ownerBuilder = rootBuilder.elem("Object"); XMLBuilder keyBuilder = ownerBuilder.elem("Key").text(key); } Properties outputProperties = new Properties(); outputProperties.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + rootBuilder.asString(outputProperties); } catch (ParserConfigurationException pce) { throw Throwables.propagate(pce); } catch (TransformerException te) { throw Throwables.propagate(te); } Payload payload = Payloads.newStringPayload(content); payload.getContentMetadata().setContentType(MediaType.TEXT_XML); byte[] md5 = md5().hashString(content, UTF_8).asBytes(); payload.getContentMetadata().setContentMD5(md5); request.setPayload(payload); return request; }  @SuppressWarnings("unchecked") @Override R bindToRequest(R request, Object input);  }### Answer:
@Test public void testWithASmallSet() { HttpRequest result = binder.bindToRequest(request, ImmutableSet.of("key1", "key2")); Payload payload = Payloads .newStringPayload("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Delete>" + "<Object><Key>key1</Key></Object><Object><Key>key2</Key></Object></Delete>"); payload.getContentMetadata().setContentType(MediaType.TEXT_XML); assertEquals(result.getPayload(), payload); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptySetThrowsException() { binder.bindToRequest(request, ImmutableSet.of()); }
@Test(expectedExceptions = NullPointerException.class) public void testFailsOnNullSet() { binder.bindToRequest(request, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testExpectedASetInstance() { binder.bindToRequest(request, ImmutableList.of()); }