### Question:
StringHelper { public static String determineContentTypeWithoutCharset(final String contentType) { if (contentType == null) { return null; } final int indexOfSemicolon = contentType.indexOf(';'); if (indexOfSemicolon != -1) { final String beforeCharset = contentType.substring(0, indexOfSemicolon); return beforeCharset.trim(); } return contentType; }  static boolean endsWithIgnoreCase(final String haystack, final String needle); static boolean equal(final String a, final String b); static boolean equalIgnoringCase(final String a, final String b); static String determineContentTypeWithoutCharset(final String contentType);  }### Answer:
@Test public void determineContentTypeWithoutCharset_null() throws Exception { final String actual = StringHelper.determineContentTypeWithoutCharset(null); Assert.assertEquals(null, actual); }
@Test public void determineContentTypeWithoutCharset_withoutCharset() throws Exception { final String input = "application/json"; final String actual = StringHelper.determineContentTypeWithoutCharset(input); Assert.assertEquals("application/json", actual); }
@Test public void determineContentTypeWithoutCharset_withCharset() throws Exception { final String input = "application/json; charset=utf-8"; final String actual = StringHelper.determineContentTypeWithoutCharset(input); Assert.assertEquals("application/json", actual); }