use of io.vertx.core.MultiMap in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testContainsTest3.
@Test
public void testContainsTest3() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
String name = "0123456789";
boolean result = mmap.contains(name);
assertFalse(result);
mmap.add(name, "");
result = mmap.contains(name);
assertTrue(result);
}
use of io.vertx.core.MultiMap in project vert.x by eclipse.
the class CaseInsensitiveHeadersTest method testAddTest10.
@Test
public void testAddTest10() throws Exception {
MultiMap mmap = new CaseInsensitiveHeaders();
String name = "a";
ArrayList<CharSequence> values = new ArrayList<CharSequence>();
values.add("somevalue");
assertEquals("a: somevalue\n", mmap.add(name, values).toString());
}
use of io.vertx.core.MultiMap 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.MultiMap 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.MultiMap 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());
}
Aggregations