Search in sources :

Example 6 with MultiMap

use of io.vertx.core.MultiMap in project vert.x by eclipse.

the class CaseInsensitiveHeadersTest method testIsEmptyTest1.

@Test
public void testIsEmptyTest1() throws Exception {
    MultiMap mmap = new CaseInsensitiveHeaders();
    assertTrue(mmap.isEmpty());
}
Also used : MultiMap(io.vertx.core.MultiMap) CaseInsensitiveHeaders(io.vertx.core.http.CaseInsensitiveHeaders) Test(org.junit.Test)

Example 7 with MultiMap

use of io.vertx.core.MultiMap in project vert.x by eclipse.

the class CaseInsensitiveHeadersTest method testToString.

@Test
public void testToString() {
    MultiMap mm = new CaseInsensitiveHeaders();
    assertEquals("", mm.toString());
    mm.add("Header1", "Value1");
    assertEquals("Header1: Value1\n", sortByLine(mm.toString()));
    mm.add("Header2", "Value2");
    assertEquals("Header1: Value1\n" + "Header2: Value2\n", sortByLine(mm.toString()));
    mm.add("Header1", "Value3");
    assertEquals("Header1: Value1\n" + "Header1: Value3\n" + "Header2: Value2\n", sortByLine(mm.toString()));
    mm.remove("Header1");
    assertEquals("Header2: Value2\n", sortByLine(mm.toString()));
    mm.set("Header2", "Value4");
    assertEquals("Header2: Value4\n", sortByLine(mm.toString()));
}
Also used : MultiMap(io.vertx.core.MultiMap) CaseInsensitiveHeaders(io.vertx.core.http.CaseInsensitiveHeaders) Test(org.junit.Test)

Example 8 with MultiMap

use of io.vertx.core.MultiMap in project vert.x by eclipse.

the class CaseInsensitiveHeadersTest method testSetTest8.

@Test
public void testSetTest8() throws Exception {
    MultiMap mmap = new CaseInsensitiveHeaders();
    CharSequence name = "name";
    ArrayList<CharSequence> values = new ArrayList<CharSequence>();
    values.add("somevalue");
    assertEquals("name: somevalue\n", mmap.set(name, values).toString());
}
Also used : MultiMap(io.vertx.core.MultiMap) CaseInsensitiveHeaders(io.vertx.core.http.CaseInsensitiveHeaders) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 9 with MultiMap

use of io.vertx.core.MultiMap in project vert.x by eclipse.

the class CaseInsensitiveHeadersTest method testSetIterable.

@Test
public void testSetIterable() throws Exception {
    MultiMap mmap = new CaseInsensitiveHeaders();
    String name = "name";
    List<String> values = new ArrayList<String>();
    values.add("value1");
    values.add(null);
    MultiMap result = mmap.set(name, values);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    assertEquals(1, result.size());
    assertEquals("name: value1\n", result.toString());
}
Also used : MultiMap(io.vertx.core.MultiMap) CaseInsensitiveHeaders(io.vertx.core.http.CaseInsensitiveHeaders) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 10 with MultiMap

use of io.vertx.core.MultiMap in project vert.x by eclipse.

the class CaseInsensitiveHeadersTest method testSetTest11.

@Test
public void testSetTest11() throws Exception {
    MultiMap mmap = new CaseInsensitiveHeaders();
    String name = "";
    String strVal = "";
    MultiMap result = mmap.set(name, strVal);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    assertEquals(1, result.size());
    assertEquals(": \n", result.toString());
}
Also used : MultiMap(io.vertx.core.MultiMap) CaseInsensitiveHeaders(io.vertx.core.http.CaseInsensitiveHeaders) Test(org.junit.Test)

Aggregations

MultiMap (io.vertx.core.MultiMap)87 Test (org.junit.Test)75 CaseInsensitiveHeaders (io.vertx.core.http.CaseInsensitiveHeaders)61 HashMap (java.util.HashMap)21 ArrayList (java.util.ArrayList)19 Map (java.util.Map)12 Buffer (io.vertx.core.buffer.Buffer)9 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)8 VertxException (io.vertx.core.VertxException)8 HttpClientRequest (io.vertx.core.http.HttpClientRequest)8 HttpMethod (io.vertx.core.http.HttpMethod)8 HeadersAdaptor (io.vertx.core.http.impl.HeadersAdaptor)8 HttpResponseStatus (io.netty.handler.codec.http.HttpResponseStatus)7 InternalLoggerFactory (io.netty.util.internal.logging.InternalLoggerFactory)7 Nullable (io.vertx.codegen.annotations.Nullable)7 AbstractVerticle (io.vertx.core.AbstractVerticle)7 AsyncResult (io.vertx.core.AsyncResult)7 Context (io.vertx.core.Context)7 DeploymentOptions (io.vertx.core.DeploymentOptions)7 Future (io.vertx.core.Future)7