### Question:
ConditionalRequestBuilder { public T buildConditionalRequestFromVariants(final T request, final Map<String, Variant> variants) { final T newRequest = messageCopier.copy(request); newRequest.setHeaders(request.getHeaders()); final StringBuilder etags = new StringBuilder(); boolean first = true; for(final String etag : variants.keySet()) { if (!first) { etags.append(","); } first = false; etags.append(etag); } newRequest.setHeader(HeaderConstants.IF_NONE_MATCH, etags.toString()); return newRequest; } ConditionalRequestBuilder(final MessageCopier<T> messageCopier); T buildConditionalRequest(final T request, final HttpCacheEntry cacheEntry); T buildConditionalRequestFromVariants(final T request, final Map<String, Variant> variants); T buildUnconditionalRequest(final T request);  }### Answer:
@Test public void testBuildConditionalRequestFromVariants() throws Exception { final String etag1 = "\"123\""; final String etag2 = "\"456\""; final String etag3 = "\"789\""; final Map<String,Variant> variantEntries = new HashMap<>(); variantEntries.put(etag1, new Variant("A", HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag1) }))); variantEntries.put(etag2, new Variant("B", HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag2) }))); variantEntries.put(etag3, new Variant("C", HttpTestUtils.makeCacheEntry(new Header[] { new BasicHeader("ETag", etag3) }))); final HttpRequest conditional = impl.buildConditionalRequestFromVariants(request, variantEntries); String ifNoneMatch = conditional.getFirstHeader(HeaderConstants.IF_NONE_MATCH).getValue(); Assert.assertTrue(ifNoneMatch.contains(etag1)); Assert.assertTrue(ifNoneMatch.contains(etag2)); Assert.assertTrue(ifNoneMatch.contains(etag3)); ifNoneMatch = ifNoneMatch.replace(etag1, ""); ifNoneMatch = ifNoneMatch.replace(etag2, ""); ifNoneMatch = ifNoneMatch.replace(etag3, ""); ifNoneMatch = ifNoneMatch.replace(",",""); ifNoneMatch = ifNoneMatch.replace(" ", ""); Assert.assertEquals(ifNoneMatch, ""); }