assertEquals(4, headergroup.getAllHeaders().length);
assertEquals("newvalue", headergroup.getFirstHeader("name2").getValue());
}
public void testSetHeaders() {
HeaderGroup headergroup = new HeaderGroup();
Header header1 = new BasicHeader("name1", "value1");
Header header2 = new BasicHeader("name2", "value2");
Header header3 = new BasicHeader("name3", "value3");
headergroup.addHeader(header1);
headergroup.setHeaders(new Header[] { header2, header3 });
assertEquals(2, headergroup.getAllHeaders().length);
assertEquals(0, headergroup.getHeaders("name1").length);
assertFalse(headergroup.containsHeader("name1"));
assertEquals(1, headergroup.getHeaders("name2").length);
assertTrue(headergroup.containsHeader("name2"));
assertEquals(1, headergroup.getHeaders("name3").length);
assertTrue(headergroup.containsHeader("name3"));
headergroup.setHeaders(null);
assertEquals(0, headergroup.getAllHeaders().length);
}