public void testGetInputAttachhmentStreams() throws Exception {
Image expectedImage;
IncomingAttachmentInputStream dataIs;
ImageDataSource dataSource;
InputStream expectedDataIs;
InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
Attachments attachments = new Attachments(inStream, contentTypeString);
// Since SOAP part operated independently of other streams, access it
// directly, and then get to the streams. If this sequence throws an
// error, something is wrong with the stream handling code.
InputStream is = attachments.getSOAPPartInputStream();
while (is.read() != -1);
// Get the inputstream container
IncomingAttachmentStreams ias = attachments.getIncomingAttachmentStreams();
dataIs = ias.getNextStream();
expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img1FileName)));
dataSource = new ImageDataSource("test1.jpg", expectedImage);
expectedDataIs = dataSource.getInputStream();
compareStreams(dataIs, expectedDataIs);
dataIs = ias.getNextStream();
expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img2FileName)));
dataSource = new ImageDataSource("test2.jpg", expectedImage);
expectedDataIs = dataSource.getInputStream();
compareStreams(dataIs, expectedDataIs);
// Confirm that no more streams are left
assertEquals(null, ias.getNextStream());