### Question:
HttpUtil { public static ContentType getContentType(String header) { final String[] arr = header.split("\\s*;\\s*"); if(arr.length == 1) { return new ContentTypeBean(header, null); } else { final String contentType = arr[0]; for(int i=1; i<arr.length; i++) { final String headerPart = arr[i]; if(headerPart.contains("charset=")) { Pattern p = Pattern.compile("charset=(.+)"); Matcher m = p.matcher(headerPart); if(m.matches()) { Charset charset = Charset.forName(m.group(1)); return new ContentTypeBean(contentType, charset); } } } return new ContentTypeBean(contentType, null); } }  static ContentType getContentType(String header); static ContentType getContentType(MultiValueMap<String, String> headers); static int getStatusCodeFromStatusLine(final String statusLine); static String getFormattedContentType(final String contentType, final String charset); static String getFormattedContentType(final String contentType, final Charset charset); static String getFormattedContentType(final ContentType contentType); static String getCharsetFromContentType(final String contentType); static String getMimeFromContentType(final String contentType); static boolean isWebImageContentType(final String contentType); static boolean isTextContentType(final String contentType); static boolean isXmlContentType(final String contentType); static boolean isJsonContentType(final String contentType); static boolean isJsContentType(final String contentType); static boolean isCssContentType(final String contentType); static boolean isHTMLContentType(final String contentType); static boolean isFormUrlEncodedContentType(final String contentType); static Charset getCharsetDefault(final ContentType type); static boolean isEntityEnclosingMethod(final String method); static boolean isEntityEnclosingMethod(final HTTPMethod method); static MultiValueMap<String, String> getXWwwFormUrlEncoded2Map(String str); static final ContentType DEFAULT_CONTENT_TYPE; static final Charset DEFAULT_CHARSET; }### Answer:
@Test public void testGetContentType_String() { System.out.println("getContentType"); String header = "application/vnd.mnet.staticwebspaces+xml;version=1;charset=UTF-8"; ContentType expResult = new ContentTypeBean("application/vnd.mnet.staticwebspaces+xml", Charsets.UTF_8); ContentType result = HttpUtil.getContentType(header); assertEquals(expResult, result); }