### Question:
ResourceCriteriaHelper { public static ResourceCriteria create(MultivaluedMap<String,String> params) { ResourceCriteria criteria = new ResourceCriteria(); criteria.clearPaging(); Method[] methods = ResourceCriteria.class.getMethods(); for (Entry<String, List<String>> e : params.entrySet()) { String value = params.getFirst(e.getKey()); if (value == null) { continue; } String paramName = paramName(e.getKey()); if (SPECIAL_PARAMS.contains(e.getKey())) { try { handleSpecialParam(criteria, e.getKey(), value); } catch (Exception ex) { throw new BadArgumentException("Unable to parse [" + e.getKey() + "] value [" + value + "] is not valid"); } } else { String filterName = "addFilter" + paramName.substring(0, 1).toUpperCase() + paramName.substring(1); Method m = findMethod(methods, filterName); if (m != null) { try { m.invoke(criteria, getValue(m, paramName, value)); } catch (BadArgumentException bae) { throw bae; } catch (Exception ex) { throw new BadArgumentException("Unable to filter by [" + paramName + "] value [" + value + "] is not valid for this filter"); } } else { throw new BadArgumentException("Unable to filter by [" + paramName + "] : filter does not exist"); } } } return criteria; }  static ResourceCriteria create(MultivaluedMap<String,String> params); static final String PARAM_SHORTCUTS_TEXT; }### Answer:
@Test(expectedExceptions = { BadArgumentException.class }, expectedExceptionsMessageRegExp = ".*does not exist.*") public void testInvalidParam() { MultivaluedMap<String, String> params = new MultivaluedMapImpl<String, String>(); params.putSingle("foo", "bar"); ResourceCriteriaHelper.create(params); }
@Test(expectedExceptions = { BadArgumentException.class }, expectedExceptionsMessageRegExp = ".*inventoryStatus is bad.*") public void testEnumParamInvalidValue() { MultivaluedMap<String, String> params = new MultivaluedMapImpl<String, String>(); params.putSingle("inventoryStatus", "FOO"); ResourceCriteriaHelper.create(params); }
@Test(expectedExceptions = { BadArgumentException.class }, expectedExceptionsMessageRegExp = ".*is not valid.*") public void testNumericParamInvalidValue() { MultivaluedMap<String, String> params = new MultivaluedMapImpl<String, String>(); params.putSingle("id", "FOO"); ResourceCriteriaHelper.create(params); }