use of io.vertx.core.http.CaseInsensitiveHeaders in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testGetHashColl.
@Test
public void testGetHashColl() {
MultiMap mm = new CaseInsensitiveHeaders();
String name1 = "!~AZ";
String name2 = "!~Y";
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 = "YA";
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 = "a";
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));
}
use of io.vertx.core.http.CaseInsensitiveHeaders in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testEntriesTest1.
@Test
public void testEntriesTest1() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
List<Map.Entry<String, String>> result = mmap.entries();
assertNotNull(result);
assertEquals(0, result.size());
}
use of io.vertx.core.http.CaseInsensitiveHeaders in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testSetTest5.
@Test
public void testSetTest5() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
MultiMap headers = new CaseInsensitiveHeaders();
MultiMap result = mmap.setAll(headers);
assertNotNull(result);
assertTrue(result.isEmpty());
assertEquals(0, result.size());
assertEquals("", result.toString());
}
use of io.vertx.core.http.CaseInsensitiveHeaders in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testAddTest5.
@Test
public void testAddTest5() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
MultiMap headers = new CaseInsensitiveHeaders();
assertEquals("", mmap.addAll(headers).toString());
}
use of io.vertx.core.http.CaseInsensitiveHeaders in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testAddTest11.
@Test
public void testAddTest11() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
String name = "";
String strVal = "";
assertEquals(": \n", mmap.add(name, strVal).toString());
}
Aggregations