本文整理了Java中io.vertx.core.MultiMap.add()
方法的一些代码示例,展示了MultiMap.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.add()
方法的具体详情如下:
包路径:io.vertx.core.MultiMap
类名称:MultiMap
方法名:add
[英]Like #add(String,String) but accepting CharSequence as parameters
[中]类似于#add(String,String),但接受CharSequence作为参数
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddConvertUpperCase() {
map.add("Foo", "foo_value");
map.add((CharSequence) "Bar", "bar_value");
map.add("Juu", (Iterable<String>)Collections.singletonList("juu_value"));
map.add("Daa", Collections.singletonList((CharSequence)"daa_value"));
assertHeaderNames("foo","bar", "juu", "daa");
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddMultiMap()
throws Exception {
MultiMap mmap = newMultiMap();
MultiMap mm = newMultiMap();
mm.add("Header1", "value1");
mm.add("Header2", "value2");
MultiMap result = mmap.addAll(mm);
assertEquals(2, result.size());
assertEquals("Header1: value1\nHeader2: value2\n", result.toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test(expected = NullPointerException.class)
public void testMapEntrySetValueNull() throws Exception {
MultiMap mmap = newMultiMap();
mmap.add("Header", "oldvalue");
for (Map.Entry<String, String> me:mmap) {
me.setValue(null);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetShouldReturnAddedEntriesInOrder() {
MultiMap mmap = newMultiMap();
mmap.add("header", "value1");
mmap.add("header", "value2");
mmap.add("header", "value3");
assertEquals("value1", mmap.get("header"));
assertEquals(Arrays.asList("value1", "value2", "value3"), mmap.getAll("header"));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddTest13()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "aaa";
String strVal = "";
assertEquals("aaa: \n", mmap.add(name, strVal).toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddTest11()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "";
String strVal = "";
assertEquals(": \n", mmap.add(name, strVal).toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddTest12()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "a";
String strVal = "b";
assertEquals("a: b\n", mmap.add(name, strVal).toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testAddIterable()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
List<String> values = new ArrayList<String>();
values.add("value1");
values.add("value2");
MultiMap result = mmap.add(name, values);
assertEquals(1, result.size());
assertEquals("name: value1\nname: value2\n", result.toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetAll()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
mmap.add(name, "value1");
mmap.add(name, "value2");
List<String> result = mmap.getAll(name);
assertNotNull(result);
assertEquals(2, result.size());
assertEquals("value1", result.get(0));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testMapEntryToString() throws Exception {
MultiMap mmap = newMultiMap();
mmap.add("Header", "value");
assertEquals("Header: value", mmap.iterator().next().toString());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testMapEntrySetValue() throws Exception {
MultiMap mmap = newMultiMap();
mmap.add("Header", "oldvalue");
for (Map.Entry<String, String> me:mmap) {
me.setValue("newvalue");
}
assertEquals("newvalue", mmap.get("Header"));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetShouldReturnEntriesFromListInOrder() {
MultiMap mmap = newMultiMap();
mmap.add("header", Arrays.<CharSequence>asList("value1", "value2", "value3"));
assertEquals("value1", mmap.get("header"));
assertEquals(Arrays.asList("value1", "value2", "value3"), mmap.getAll("header"));
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testIteratorTest2()
throws Exception {
MultiMap mmap = newMultiMap();
mmap.add("a", "b");
Iterator<Map.Entry<String, String>> result = mmap.iterator();
assertNotNull(result);
assertTrue(result.hasNext());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testIsEmptyTest2()
throws Exception {
MultiMap mmap = newMultiMap();
mmap.add("a", "b");
assertFalse(mmap.isEmpty());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueStringIgnoreCase() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
assertTrue(mmap.contains("heaDer", "vAlue", true));
assertTrue(mmap.contains("heaDer", "Value", true));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testGetTest3()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
String result = mmap.get(name);
assertNull(result);
mmap.add(name, "value");
result = mmap.get(name);
assertEquals("value", result);
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueString() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
assertTrue(mmap.contains("heaDer", "vAlue", false));
assertFalse(mmap.contains("heaDer", "Value", false));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testRemoveTest4()
throws Exception {
MultiMap mmap = newMultiMap();
String name = "name";
String value = "value";
mmap.add(name, value);
assertTrue(mmap.contains(name));
MultiMap result = mmap.remove(name);
assertFalse(result.contains(name));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequenceIgnoreCase() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
CharSequence name = HttpHeaders.createOptimized("heaDer");
CharSequence vAlue = HttpHeaders.createOptimized("vAlue");
CharSequence Value = HttpHeaders.createOptimized("Value");
assertTrue(mmap.contains(name, vAlue, true));
assertTrue(mmap.contains(name, Value, true));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testContainsValueCharSequence() {
MultiMap mmap = newMultiMap();
mmap.add("headeR", "vAlue");
CharSequence name = HttpHeaders.createOptimized("heaDer");
CharSequence vAlue = HttpHeaders.createOptimized("vAlue");
CharSequence Value = HttpHeaders.createOptimized("Value");
assertTrue(mmap.contains(name, vAlue, false));
assertFalse(mmap.contains(name, Value, false));
}
内容来源于网络,如有侵权,请联系作者删除!