assertEquals(2, mmap.size());
}
@Test
public void testGetHashColl() {
MultiMap mm = new CaseInsensitiveHeaders();
String name1 = "!~AZ";
String name2 = "!~\u0080Y";
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
mm = new CaseInsensitiveHeaders();
name1 = "";
name2 = "\0";
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
mm = new CaseInsensitiveHeaders();
name1 = "AZa";
name2 = "\u0080YA";
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
mm = new CaseInsensitiveHeaders();
name1 = " !";
name2 = "? ";
assertTrue("hash error", hash(name1) == hash(name2));
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
mm = new CaseInsensitiveHeaders();
name1 = "\u0080a";
name2 = "Ab";
assertTrue("hash error", hash(name1) == hash(name2));
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
// same bucket, different hash
mm = new CaseInsensitiveHeaders();
name1 = "A";
name2 = "R";
assertTrue("hash error", index(hash(name1)) == index(hash(name2)));
mm.add(name1, "value1");
mm.add(name2, "value2");
assertEquals(2, mm.size());
assertEquals("value1", mm.get(name1));
assertEquals("value2", mm.get(name2));
}