expect(soapRequest.getSoapBody()).andReturn(soapBody).once();
expect(soapBody.getPayloadResult()).andReturn(new StringResult()).once();
expect(soapRequest.addAttachment(eq(attachment.getContentId()), (InputStreamSource)anyObject(), eq(attachment.getContentType()))).andAnswer(new IAnswer<Attachment>() {
public Attachment answer() throws Throwable {
InputStreamSource contentStream = (InputStreamSource)EasyMock.getCurrentArguments()[1];
BufferedReader reader = new BufferedReader(new InputStreamReader(contentStream.getInputStream()));
Assert.assertEquals(reader.readLine(), "This is a SOAP attachment");
Assert.assertEquals(reader.readLine(), "with multi-line");
reader.close();