### Question:
AcceptType implements Comparable<AcceptType> { public static Double getQfromString(String strIn) { Matcher matcher = qRe.matcher(strIn); if (!matcher.find()) { return null; } return Double.parseDouble(matcher.group(1)); } AcceptType(); MediaType getMediaType(); static AcceptType newInstance(String strIn); String toString(); static boolean isAcceptableMedia(AcceptType requested, AcceptType offerd); static boolean mediaMatch(AcceptType t, AcceptType o); @Override int compareTo(AcceptType o); void setMediaType(MediaType mediaType); double getQ(); void setQ(double q); List<String> getAcceptExtensions(); void setAcceptExtensions(List<String> acceptExtensions); static Double getQfromString(String strIn);  }### Answer:
@Test public void qParamShouldReturnNullWhenNoQparamisInvalid() { Assert.assertNull(AcceptType.getQfromString("Nothing here")); Assert.assertNull(AcceptType.getQfromString("q = this is not a q param")); Assert.assertNull(AcceptType.getQfromString("q = 3.22 this is also not a q param")); }
@Test public void qParamShouldReturnValidDoublsWhenInputStringIsValid() { Assert.assertEquals(3.141, AcceptType.getQfromString("q = 3.141"), 0.0); Assert.assertEquals(3.141, AcceptType.getQfromString(" q = 3.141 "), 0.0); }