public void FIXME_testSingleToWithSingleCCAndBCC() throws Exception {
EmailWorkItemHandler handler = new EmailWorkItemHandler();
handler.setConnection( emailHost, emailPort, null, null );
WorkItemImpl workItem = new WorkItemImpl();
workItem.setParameter( "To", "person1@domain.com" );
workItem.setParameter( "Cc", "person2@domain.com" );
workItem.setParameter( "Bcc", "person3@domain.com" );
workItem.setParameter( "From", "person4@domain.com" );
workItem.setParameter( "Reply-To", "person5@domain.com" );
workItem.setParameter( "Subject", "Subject 1" );
workItem.setParameter( "Body", "Body 1" );
WorkItemManager manager = new DefaultWorkItemManager(null);
handler.executeWorkItem( workItem, manager );
assertEquals( 3, wiser.getMessages().size() );
List<String> list = new ArrayList<String>(3);
list.add( wiser.getMessages().get( 0 ).getEnvelopeReceiver() );
list.add( wiser.getMessages().get( 1 ).getEnvelopeReceiver() );
list.add( wiser.getMessages().get( 2 ).getEnvelopeReceiver() );
assertTrue( list.contains("person1@domain.com"));
assertTrue( list.contains("person2@domain.com"));
assertTrue( list.contains("person3@domain.com"));
MimeMessage msg = (( WiserMessage ) wiser.getMessages().get( 0 )).getMimeMessage();
assertEquals( workItem.getParameter( "From" ), wiser.getMessages().get( 0 ).getEnvelopeSender() );
assertEquals( workItem.getParameter( "Body" ), msg.getContent() );
assertEquals( workItem.getParameter( "Subject" ), msg.getSubject() );
assertEquals( workItem.getParameter( "From" ), ((InternetAddress)msg.getFrom()[0]).getAddress() );
assertEquals( workItem.getParameter( "Reply-To" ), ((InternetAddress)msg.getReplyTo()[0]).getAddress() );
assertEquals( workItem.getParameter( "To" ), ((InternetAddress)msg.getRecipients( RecipientType.TO )[0]).getAddress() );
assertEquals( workItem.getParameter( "Cc" ),((InternetAddress)msg.getRecipients( RecipientType.CC )[0]).getAddress() );
msg = (( WiserMessage ) wiser.getMessages().get( 1 )).getMimeMessage();
assertEquals( workItem.getParameter( "From" ), wiser.getMessages().get( 1 ).getEnvelopeSender() );
assertEquals( workItem.getParameter( "Body" ), msg.getContent() );
assertEquals( workItem.getParameter( "Subject" ), msg.getSubject() );
assertEquals( workItem.getParameter( "From" ), ((InternetAddress)msg.getFrom()[0]).getAddress() );
assertEquals( workItem.getParameter( "Reply-To" ), ((InternetAddress)msg.getReplyTo()[0]).getAddress() );
assertEquals( workItem.getParameter( "To" ), ((InternetAddress)msg.getRecipients( RecipientType.TO )[0]).getAddress() );
assertEquals( workItem.getParameter( "Cc" ),((InternetAddress)msg.getRecipients( RecipientType.CC )[0]).getAddress() );
msg = (( WiserMessage ) wiser.getMessages().get( 2 )).getMimeMessage();
assertEquals( workItem.getParameter( "From" ), wiser.getMessages().get( 2 ).getEnvelopeSender() );
assertEquals( workItem.getParameter( "Body" ), msg.getContent() );
assertEquals( workItem.getParameter( "Subject" ), msg.getSubject() );
assertEquals( workItem.getParameter( "From" ), ((InternetAddress)msg.getFrom()[0]).getAddress() );
assertEquals( workItem.getParameter( "Reply-To" ), ((InternetAddress)msg.getReplyTo()[0]).getAddress() );
assertEquals( workItem.getParameter( "To" ), ((InternetAddress)msg.getRecipients( RecipientType.TO )[0]).getAddress() );
assertEquals( workItem.getParameter( "Cc" ),((InternetAddress)msg.getRecipients( RecipientType.CC )[0]).getAddress() );
}