}
private FormDataItem mockFormDataItem(String fieldName, String contentType, byte content[],
boolean isFormField) throws IOException {
InputStream in = new ByteArrayInputStream(content);
FormDataItem formDataItem = mockControl.createMock(FormDataItem.class);
expect(formDataItem.getContentType()).andStubReturn(contentType);
expect(formDataItem.getSize()).andStubReturn((long) content.length);
expect(formDataItem.get()).andStubReturn(content);
expect(formDataItem.getAsString()).andStubReturn(new String(content));
expect(formDataItem.getFieldName()).andStubReturn(fieldName);
expect(formDataItem.isFormField()).andStubReturn(isFormField);
expect(formDataItem.getInputStream()).andStubReturn(in);
return formDataItem;
}