### Question:
BatchTransformatorCommon { public static void validateContentType(final Header headers) throws BatchException { List<String> contentTypes = headers.getHeaders(HttpHeaders.CONTENT_TYPE); if (contentTypes.isEmpty()) { throw new BatchException(BatchException.MISSING_CONTENT_TYPE); } if (!headers.isHeaderMatching(HttpHeaders.CONTENT_TYPE, BatchParserCommon.PATTERN_MULTIPART_MIXED) && !headers.isHeaderMatching(HttpHeaders.CONTENT_TYPE, BatchParserCommon.PATTERN_CONTENT_TYPE_APPLICATION_HTTP)) { throw new BatchException(BatchException.INVALID_CONTENT_TYPE.addContent( HttpContentType.MULTIPART_MIXED + " or " + HttpContentType.APPLICATION_HTTP)); } }  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 testValidateContentTypeApplicationHTTP() throws BatchException { List<String> contentTypeValues = Arrays.asList(new String[] { HttpContentType.APPLICATION_HTTP }); final Header headers = makeHeaders(HttpHeaders.CONTENT_TYPE, contentTypeValues); BatchTransformatorCommon.validateContentType(headers); }
@Test public void testValidateContentTypeMultipartMixed() throws BatchException { List<String> contentTypeValues = Arrays.asList(new String[] { HttpContentType.MULTIPART_MIXED + "; boundary=batch_32332_32323_fdsf" }); final Header headers = makeHeaders(HttpHeaders.CONTENT_TYPE, contentTypeValues); BatchTransformatorCommon.validateContentType(headers); }
@Test public void testValidateContentTypeMultipartMixedCaseInsensitiv() throws BatchException { List<String> contentTypeValues = Arrays.asList(new String[] { "mulTiPart/MiXed; boundary=batch_32332_32323_fdsf" }); final Header headers = makeHeaders(HttpHeaders.CONTENT_TYPE, contentTypeValues); BatchTransformatorCommon.validateContentType(headers); }
@Test(expected = BatchException.class) public void testValidateContentTypeNoValue() throws BatchException { List<String> contentTypeValues = Arrays.asList(new String[] {}); final Header headers = makeHeaders(HttpHeaders.CONTENT_TYPE, contentTypeValues); BatchTransformatorCommon.validateContentType(headers); }
@Test(expected = BatchException.class) public void testValidateContentTypeMissingHeader() throws BatchException { final Header headers = new Header(1); BatchTransformatorCommon.validateContentType(headers); }
@Test(expected = BatchException.class) public void testValidateContentTypeMultipleValues() throws BatchException { List<String> contentTypeValues = Arrays.asList(new String[] { HttpContentType.APPLICATION_HTTP, HttpContentType.MULTIPART_MIXED }); final Header headers = makeHeaders(HttpHeaders.CONTENT_TYPE, contentTypeValues); BatchTransformatorCommon.validateContentType(headers); }