}
public void testDribble() throws Exception {
PartData list = new PartData();
PartSeriesConsumer consumer = new PartSeriesConsumer(new ArrayAllocator(), list, "AaB03x".getBytes("UTF-8"));
Cursor cursor = new DribbleCursor(new StreamCursor(NORMAL), 1);
while(!consumer.isFinished()) {
consumer.consume(cursor);
}
assertEquals(list.getParts().size(), 3);
assertEquals(list.getParts().get(0).getContentType().getPrimary(), "text");
assertEquals(list.getParts().get(0).getContentType().getSecondary(), "plain");
assertEquals(list.getParts().get(0).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file1.txt'");
assertEquals(list.getParts().get(0).getContent(), "example contents of file1.txt");
assertEquals(list.getParts().get(1).getContentType().getPrimary(), "text");
assertEquals(list.getParts().get(1).getContentType().getSecondary(), "plain");
assertEquals(list.getParts().get(1).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file2.txt'");
assertEquals(list.getParts().get(1).getContent(), "example contents of file2.txt");
assertEquals(list.getParts().get(2).getContentType().getPrimary(), "text");
assertEquals(list.getParts().get(2).getContentType().getSecondary(), "plain");
assertEquals(list.getParts().get(2).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file3.txt'");
assertEquals(list.getParts().get(2).getContent(), "example contents of file3.txt ...");
assertEquals(cursor.ready(), -1);
assertEquals(consumer.getBody().getContent(), NORMAL);
}