Exemplo n.º 1
0
 @Test
 public void testDefaultMethods() {
   List<String> methods =
       Arrays.asList(
           "connect", "DELEte", "geT", "HEAD", "OpTiOnS", "patch", "post", "pURGe", "put",
           "Trace");
   Set<HTTPMethod> actual = new LinkedHashSet<HTTPMethod>();
   for (String method : methods) {
     actual.add(HTTPMethod.valueOf(method));
   }
   Assert.assertEquals(defaultMethods.size(), actual.size());
   ArrayList<HTTPMethod> expected = new ArrayList<>(defaultMethods.values());
   Collections.sort(expected);
   Iterator<HTTPMethod> defaultIterator = expected.iterator();
   Iterator<HTTPMethod> actualIterator = actual.iterator();
   while (actualIterator.hasNext()) {
     HTTPMethod m = defaultIterator.next();
     HTTPMethod am = actualIterator.next();
     Assert.assertSame(m, am);
   }
 }
Exemplo n.º 2
0
 @Test(expected = IllegalArgumentException.class)
 public void testEmpty() {
   HTTPMethod.valueOf("");
   HTTPMethod.valueOf(" ");
 }
Exemplo n.º 3
0
 @Test(expected = IllegalArgumentException.class)
 public void testNull() {
   HTTPMethod.valueOf(null);
 }
Exemplo n.º 4
0
 @Test
 public void testUnknown() {
   Assert.assertFalse(defaultMethods.containsValue(HTTPMethod.valueOf("UNKNOWN")));
 }