use of io.helidon.common.http.HashParameters in project helidon by oracle.
the class HashParametersTest method addNull.
@Test
public void addNull() throws Exception {
HashParameters hashParameters = HashParameters.create();
hashParameters.add("a", ((String[]) null));
hashParameters.add("a", "value");
hashParameters.add("a", ((String[]) null));
hashParameters.add("a", (Iterable<String>) null);
assertThat(hashParameters.all("a"), contains(is("value")));
assertThat(hashParameters.first("a").get(), is("value"));
}
use of io.helidon.common.http.HashParameters in project helidon by oracle.
the class HashParametersTest method addMultipleAtOnce.
@SuppressWarnings("unchecked")
@Test
public void addMultipleAtOnce() throws Exception {
HashParameters hashParameters = HashParameters.create();
hashParameters.add("a", "v1", "v2");
assertThat(hashParameters.all("a"), contains(is("v1"), is("v2")));
assertThat(hashParameters.first("a").get(), is("v1"));
}
use of io.helidon.common.http.HashParameters in project helidon by oracle.
the class HashParametersTest method addMultipleOneByOne.
@SuppressWarnings("unchecked")
@Test
public void addMultipleOneByOne() throws Exception {
HashParameters hashParameters = HashParameters.create();
hashParameters.add("a", "v1");
hashParameters.add("a", "v2");
assertThat(hashParameters.all("a"), contains(is("v1"), is("v2")));
assertThat(hashParameters.first("a").get(), is("v1"));
}
use of io.helidon.common.http.HashParameters in project helidon by oracle.
the class HashParametersTest method addAll.
@Test
public void addAll() throws Exception {
HashParameters hp = HashParameters.create();
hp.put("a", "a1", "a2");
hp.put("b", "b1", "b2");
HashParameters hp2 = HashParameters.create();
hp2.put("c", "c1", "c2");
hp2.put("b", "b3", "b4");
hp.addAll(hp2);
assertThat(hp.all("a"), contains("a1", "a2"));
assertThat(hp.all("b"), contains("b1", "b2", "b3", "b4"));
assertThat(hp.all("c"), contains("c1", "c2"));
hp.addAll(null);
assertThat(hp.all("b"), contains("b1", "b2", "b3", "b4"));
}
use of io.helidon.common.http.HashParameters in project helidon by oracle.
the class HashParametersTest method concatNullAndEmpty.
@Test
public void concatNullAndEmpty() throws Exception {
Parameters[] prms = null;
HashParameters concat = HashParameters.concat(prms);
assertThat(concat, notNullValue());
prms = new Parameters[10];
concat = HashParameters.concat(prms);
assertThat(concat, notNullValue());
concat = HashParameters.concat();
assertThat(concat, notNullValue());
}
Aggregations