### Question:
ContentTypes { public static String extractMimePart(String contentType) throws InvalidContentTypeException { if (Strings.isNullOrEmpty(contentType)) { throw new InvalidContentTypeException("No Content-Type specified."); } contentType = contentType.trim(); int separator = contentType.indexOf(';'); if (separator != -1) { contentType = contentType.substring(0, separator); } return contentType.trim().toLowerCase(); } private  ContentTypes(); static String extractMimePart(String contentType); static void checkContentTypes(Set<String> allowedContentTypes,
      String contentType); static final Set<String> ALLOWED_JSON_CONTENT_TYPES; static final Set<String> ALLOWED_XML_CONTENT_TYPES; static final Set<String> ALLOWED_ATOM_CONTENT_TYPES; static final Set<String> FORBIDDEN_CONTENT_TYPES; static final String MULTIPART_FORM_CONTENT_TYPE; static final Set<String> ALLOWED_MULTIPART_CONTENT_TYPES; static final String OUTPUT_JSON_CONTENT_TYPE; static final String OUTPUT_XML_CONTENT_TYPE; static final String OUTPUT_ATOM_CONTENT_TYPE; }### Answer:
@Test public void textExtractMimePart() throws Exception { assertEquals("text/xml", ContentTypes.extractMimePart("Text/Xml ; charset = ISO-8859-1;x=y")); }
@Test(expected=ContentTypes.InvalidContentTypeException.class) public void testExtractMimePartNull() throws Exception { ContentTypes.extractMimePart(null); }
@Test(expected=ContentTypes.InvalidContentTypeException.class) public void testExtractMimePartEmptyString() throws Exception { ContentTypes.extractMimePart(""); }