assertEquals("received", header.getFields().get(1).getName());
assertEquals("Content-type", header.getFields().get(2).getName());
}
public void testSetNonExistantField() throws Exception {
Header header = new HeaderImpl();
header.addField(DefaultFieldParser.parse("Received: from foo by bar for james"));
header.addField(DefaultFieldParser.parse("Content-type: text/plain; charset=US-ASCII"));
header.addField(DefaultFieldParser.parse("ReCeIvEd: from bar by foo for james"));
header.setField(DefaultFieldParser.parse("Message-ID: <msg9901@apache.org>"));
assertEquals(4, header.getFields().size());
assertEquals(1, header.getFields("message-id").size());
assertEquals("Message-ID", header.getFields().get(3).getName());
}