use of org.glassfish.jersey.message.internal.ParameterizedHeader in project jersey by jersey.
the class ParameterizedHeadersMapTest method testEntrySet.
/**
* Test of entrySet method, of class ParametrizedHeadersMap.
*/
@Test
public void testEntrySet() throws Exception {
List<ParameterizedHeader> valuesFoo = new ArrayList<>();
valuesFoo.add(new ParameterizedHeader("foo1"));
valuesFoo.add(new ParameterizedHeader("foo2"));
map.put("foo", valuesFoo);
List<ParameterizedHeader> valuesBar = new ArrayList<>();
valuesBar.add(new ParameterizedHeader("bar1"));
valuesBar.add(new ParameterizedHeader("bar2"));
map.put("bar", valuesBar);
Set<Entry<String, List<ParameterizedHeader>>> entrySet = map.entrySet();
assertEquals(2, entrySet.size());
// TODO - detailed tests for the HeadersEntries methods
}
use of org.glassfish.jersey.message.internal.ParameterizedHeader in project jersey by jersey.
the class ParameterizedHeadersMapTest method testSize.
/**
* Test of size method, of class ParametrizedHeadersMap.
*/
@Test
public void testSize() throws Exception {
assertEquals(0, map.size());
map.add("foo", new ParameterizedHeader("bar"));
assertEquals(1, map.size());
map.add("foo", new ParameterizedHeader("arg"));
assertEquals(1, map.size());
map.add("baz", new ParameterizedHeader("bop"));
assertEquals(2, map.size());
map.remove("baz");
assertEquals(1, map.size());
map.remove("foo");
assertEquals(0, map.size());
}
use of org.glassfish.jersey.message.internal.ParameterizedHeader in project jersey by jersey.
the class ParameterizedHeadersMapTest method testContainsValue.
/**
* Test of containsValue method, of class ParametrizedHeadersMap.
*/
@Test
public void testContainsValue() throws Exception {
List<ParameterizedHeader> values = new ArrayList<>();
values.add(new ParameterizedHeader("bar"));
values.add(new ParameterizedHeader("bop"));
map.put("foo", values);
assertTrue(map.containsValue(values));
map.clear();
assertTrue(!map.containsValue(values));
}
use of org.glassfish.jersey.message.internal.ParameterizedHeader in project jersey by jersey.
the class ParameterizedHeadersMapTest method testValues.
/**
* Test of values method, of class ParametrizedHeadersMap.
*/
@Test
public void testValues() throws Exception {
Map<String, List<ParameterizedHeader>> all = new HashMap<>();
List<ParameterizedHeader> fooValues = new ArrayList<>();
fooValues.add(new ParameterizedHeader("foo1"));
fooValues.add(new ParameterizedHeader("foo2"));
all.put("foo", fooValues);
List<ParameterizedHeader> barValues = new ArrayList<>();
barValues.add(new ParameterizedHeader("bar1"));
barValues.add(new ParameterizedHeader("bar2"));
all.put("bar", barValues);
map.putAll(all);
Collection<List<ParameterizedHeader>> values = map.values();
assertNotNull(values);
assertEquals(2, values.size());
List[] array = new List[2];
array = values.toArray(array);
if (array[0] == fooValues) {
assertTrue(array[1] == barValues);
} else if (array[0] == barValues) {
assertTrue(array[1] == fooValues);
} else {
fail("Returned values were corrupted");
}
}
use of org.glassfish.jersey.message.internal.ParameterizedHeader in project jersey by jersey.
the class ParameterizedHeadersMapTest method testClear.
/**
* Test of clear method, of class ParametrizedHeadersMap.
*/
@Test
public void testClear() throws Exception {
map.add("foo", new ParameterizedHeader("bar"));
map.add("baz", new ParameterizedHeader("bop"));
assertTrue(!map.isEmpty());
assertEquals(2, map.size());
map.clear();
assertEquals(0, map.size());
assertTrue(map.isEmpty());
}