assertEquals( "steve@domain.com",
((InternetAddress) msg.getRecipients( RecipientType.TO )[0]).getAddress() );
assertEquals( "Task Assignment Start Event: This is my task name",
msg.getSubject() );
MimeMultipart multiPart = (MimeMultipart) msg.getContent();
BodyPart messageBodyPart = multiPart.getBodyPart( 0 );
assertEquals( "text/plain; charset=UTF8;", messageBodyPart.getDataHandler().getContentType() );
String content = new String( getBytes( messageBodyPart.getDataHandler().getInputStream() ) );
assertEqualsIgnoreWhitespace( subject + description, content );
messageBodyPart = multiPart.getBodyPart( 1 );
assertEquals( "text/calendar; charset=UTF8; name=ical-Start-1.ics", messageBodyPart.getDataHandler().getContentType() );
content = new String( getBytes( messageBodyPart.getDataHandler().getInputStream() ) );
assertEqualsIgnoreWhitespace( "BEGIN:VCALENDARPRODID:-//iCal4j 1.0//ENCALSCALE:GREGORIANVERSION:2.0METHOD:REQUESTBEGIN:VEVENTDTSTART;TZID=UTC:", content.substring( 0, 123) );
assertEqualsIgnoreWhitespace( "SUMMARY:\"Task Start : This is my task subject\"DESCRIPTION:\"This is my task description\"PRIORITY:55END:VEVENTEND:VCALENDAR", content.substring( content.length()-131, content.length()) );
msg = ((WiserMessage) getWiser().getMessages().get( 1 )).getMimeMessage();
assertEqualsIgnoreWhitespace( "multipart/alternative;boundary=\"----=_Part_",
msg.getContentType(),
0,
47 );
assertEquals( "tony@domain.com",
((InternetAddress) msg.getFrom()[0]).getAddress() );
assertEquals( "tony@domain.com",
((InternetAddress) msg.getReplyTo()[0]).getAddress() );
assertEquals( "steve@domain.com",
((InternetAddress) msg.getRecipients( RecipientType.TO )[0]).getAddress() );
assertEquals( "Task Assignment End Event: This is my task name",
msg.getSubject() );
multiPart = (MimeMultipart) msg.getContent();
messageBodyPart = multiPart.getBodyPart( 0 );
assertEquals( "text/plain; charset=UTF8;", messageBodyPart.getDataHandler().getContentType() );
content = new String( getBytes( messageBodyPart.getDataHandler().getInputStream() ) );
assertEqualsIgnoreWhitespace( subject + description, content );
messageBodyPart = multiPart.getBodyPart( 1 );
assertEquals( "text/calendar; charset=UTF8; name=ical-End-1.ics", messageBodyPart.getDataHandler().getContentType() );
content = new String( getBytes( messageBodyPart.getDataHandler().getInputStream() ) );
assertEqualsIgnoreWhitespace( "BEGIN:VCALENDARPRODID:-//iCal4j 1.0//ENCALSCALE:GREGORIANVERSION:2.0METHOD:REQUESTBEGIN:VEVENTDTSTART;TZID=UTC:", content.substring( 0, 123) );
assertEqualsIgnoreWhitespace( "SUMMARY:\"Task End : This is my task subject\"DESCRIPTION:\"This is my task description\"PRIORITY:55END:VEVENTEND:VCALENDAR", content.substring( content.length()-131, content.length()) );
}