HTTPMethod implements Comparable<HTTPMethod> { public static HTTPMethod valueOf(String method) { if (method == null || method.isEmpty()) { throw new IllegalArgumentException("method may not be null or empty"); } String uppercaseMethod = method.toUpperCase(Locale.ENGLISH); if (defaultMethods.containsKey(uppercaseMethod)) { return defaultMethods.get(uppercaseMethod); } return new HTTPMethod(uppercaseMethod); } private  HTTPMethod(String method); private  HTTPMethod(String method, Idempotency idempotency, Safety safety); String getMethod(); @Deprecated String name(); @Override String toString(); static HTTPMethod[] values(); static HTTPMethod valueOf(String method); @Override boolean equals(Object o); @Override int compareTo(HTTPMethod other); @Override int hashCode(); boolean canHavePayload(); boolean isSafe(); boolean isCacheable(); boolean isIdempotent(); static final HTTPMethod CONNECT; static final HTTPMethod DELETE; static final HTTPMethod GET; static final HTTPMethod HEAD; static final HTTPMethod OPTIONS; static final HTTPMethod PATCH; static final HTTPMethod POST; static final HTTPMethod PURGE; static final HTTPMethod PUT; static final HTTPMethod TRACE; static final Map<String, HTTPMethod> defaultMethods; }
@Test public void testUnknown() { Assert.assertFalse(defaultMethods.containsValue(HTTPMethod.valueOf("UNKNOWN"))); }
@Test(expected = IllegalArgumentException.class) public void testNull() { HTTPMethod.valueOf(null); }
@Test(expected = IllegalArgumentException.class) public void testEmpty() { HTTPMethod.valueOf(""); HTTPMethod.valueOf(" "); }