Search in sources :

Example 1 with StringKeyIgnoreCaseMultivaluedMap

use of org.glassfish.jersey.internal.util.collection.StringKeyIgnoreCaseMultivaluedMap in project jersey by jersey.

the class StringKeyIgnoreCaseMultivaluedMapAsHeadersMapTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    StringKeyIgnoreCaseMultivaluedMap map2 = new StringKeyIgnoreCaseMultivaluedMap();
    List valuesFoo = new ArrayList();
    valuesFoo.add("foo1");
    valuesFoo.add("foo2");
    map.put("foo", valuesFoo);
    map2.put("foo", valuesFoo);
    List valuesBar = new ArrayList();
    valuesBar.add("bar1");
    valuesBar.add("bar2");
    map.put("bar", valuesBar);
    map2.put("bar", valuesBar);
    assertTrue(map.equals(map2));
    assertTrue(map2.equals(map));
    assertEquals(map.hashCode(), map2.hashCode());
    map2.remove("bar");
    assertTrue(!map.equals(map2));
    assertTrue(!map2.equals(map));
}
Also used : StringKeyIgnoreCaseMultivaluedMap(org.glassfish.jersey.internal.util.collection.StringKeyIgnoreCaseMultivaluedMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 StringKeyIgnoreCaseMultivaluedMap (org.glassfish.jersey.internal.util.collection.StringKeyIgnoreCaseMultivaluedMap)1 Test (org.junit.Test)1