private void checkOutput(
final Map<String, String> params,
final Collection<FileFieldInfo> fileParams) throws IOException
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
FormDataWriter writer = new FormDataWriter()
{
@Override
protected void write() throws IOException
{
for(Map.Entry<String,String> entry : params.entrySet())
{
addField(entry.getKey(), entry.getValue());
}
for(FileFieldInfo info : fileParams)
{
addFileField(info.name, info.fileName, info.subWriter);
}
}
};
writer.write(out);
String expected = createExpectedOutput(writer.boundary, params, fileParams);
assertEquals(expected, TestUtils.asString(out));
}