### Question:
MediaType { public static MediaType newInstance(String headerStr) { MediaType out = null; String[] vals; int i; if (headerStr == null) { return out; } vals = headerStr.split(";"); Matcher matcher = mtRe.matcher(vals[0].trim()); if (!matcher.find()) { return out; } out = new MediaType(); out.setType(matcher.group(1)); out.setSubtype(matcher.group(2)); for (i = 1; i < vals.length; i++) { out.getParameters().add(vals[i].trim()); } return out; } MediaType(); static MediaType newInstance(String headerStr); String getType(); void setType(String type); String getSubtype(); void setSubtype(String subtype); List<String> getParameters(); void setParameters(List<String> parameters); static boolean matches(MediaType t, MediaType o);  }### Answer:
@Test public void shouldReturnNullWhenStringIsInvalid() { Assert.assertEquals("Expected to map to a null value when passing in null", null, MediaType.newInstance(null)); Assert.assertEquals("Expected to map to a null value when passing \"blah\"", null, MediaType.newInstance("blah")); }