}
public void testCreateMultipartMimeContent() throws Exception {
MessageExt sipMessage = (MessageExt) messageFactory.createRequest(messageString);
ContentTypeHeader cth = headerFactory.createContentTypeHeader("multipart", "alternative");
cth.setParameter("boundary","myboundary");
MultipartMimeContent mmc = messageFactory.createMultipartMimeContent(cth, type, subtype, content);
Iterator<Content> contentIterator = mmc.getContents();
int i = 0;
while (contentIterator.hasNext() ) {
Content contentImpl = contentIterator.next();
assertEquals("Content must match",contentImpl.getContent(), content[i]);
assertEquals("Content Type match", contentImpl.getContentTypeHeader().getContentType(),type[i]);
assertEquals("Content subtype match",contentImpl.getContentTypeHeader().getContentSubType(),subtype[i]);
i++;
}
String mmcContentString = mmc.toString();
sipMessage.setContent(mmcContentString, cth);
MultipartMimeContent mmc1 = sipMessage.getMultipartMimeContent();
contentIterator = mmc1.getContents();
i = 0;
while (contentIterator.hasNext() ) {
Content contentImpl = contentIterator.next();
assertEquals("Content must match",contentImpl.getContent(), content[i]);
assertEquals("Content Type match", contentImpl.getContentTypeHeader().getContentType(),type[i]);
assertEquals("Content subtype match",contentImpl.getContentTypeHeader().getContentSubType(),subtype[i]);
i++;
}
MessageExt message1 = (MessageExt) messageFactory.createRequest(messageSting1);
ContentTypeHeader cth1 = (ContentTypeHeader)((HeaderFactoryExt)headerFactory).createHeader(contentType1);
message1.setContent(contentString1, cth1);
System.out.println("SIP Message after adding content " + message1);
MultipartMimeContent mmc2 = message1.getMultipartMimeContent();