### Question:
BatchTransformatorCommon { public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } }  static void validateContentType(final Header headers); static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest); static int getContentLength(final Header headers); static void validateHost(final Header headers, final String baseUri);  }### Answer:
@Test public void testValidateContentTransferEncoding() throws BatchException { List<String> contentTransferEncoding = Arrays.asList(new String[] { BatchHelper.BINARY_ENCODING }); final Header headers = makeHeaders(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING, contentTransferEncoding); BatchTransformatorCommon.validateContentTransferEncoding(headers, false); }
@Test(expected = BatchException.class) public void testValidateContentTransferEncodingMultipleValues() throws BatchException { List<String> contentTransferEncoding = Arrays.asList(new String[] { BatchHelper.BINARY_ENCODING, BASE64_ENCODING }); final Header headers = makeHeaders(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING, contentTransferEncoding); BatchTransformatorCommon.validateContentTransferEncoding(headers, false); }
@Test(expected = BatchException.class) public void testValidateContentTransferEncodingMissingHeader() throws BatchException { final Header headers = new Header(1); BatchTransformatorCommon.validateContentTransferEncoding(headers, true); }
@Test(expected = BatchException.class) public void testValidateContentTransferEncodingMissingValue() throws BatchException { List<String> contentTransferEncoding = Arrays.asList(new String[] {}); final Header headers = makeHeaders(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING, contentTransferEncoding); BatchTransformatorCommon.validateContentTransferEncoding(headers, true); }