@Test public void createMultipleMessages() throws Exception { MimeMessage source = new MimeMessage(Session.getInstance(new Properties())); source.setFrom(new InternetAddress("localhost@xwiki.org")); source.addRecipient(Message.RecipientType.TO, new InternetAddress("john@doe.com")); source.setSubject("Subject"); source.setText("Content"); MimeMessage first =this.mimeMessageFactory.createMessage(source, null); assertEqualMimeMessage(first, source); first.setFrom(new InternetAddress("jane@doe.com")); first.addRecipient(Message.RecipientType.TO, new InternetAddress("jack@doe.com")); first.setSubject("First subject"); first.setText("First content"); MimeMessage second = this.mimeMessageFactory.createMessage(source, null); assertEqualMimeMessage(second, source); }
@Override public MimeMessage createMessage(Object source, Map<String, Object> parameters) throws MessagingException { if (!(source instanceof MimeMessage)) { throw new MessagingException( String.format("Failed to create mime message from source [%s]", source.getClass())); } return new ExtendedMimeMessage((MimeMessage) source); }
MessageMimeMessageFactory extends AbstractMimeMessageFactory<MimeMessage> { @Override public MimeMessage createMessage(Object source, Map<String, Object> parameters) throws MessagingException { if (!(source instanceof MimeMessage)) { throw new MessagingException( String.format("Failed to create mime message from source [%s]", source.getClass())); } return new ExtendedMimeMessage((MimeMessage) source); } }
MessageMimeMessageFactory extends AbstractMimeMessageFactory<MimeMessage> { @Override public MimeMessage createMessage(Object source, Map<String, Object> parameters) throws MessagingException { if (!(source instanceof MimeMessage)) { throw new MessagingException( String.format("Failed to create mime message from source [%s]", source.getClass())); } return new ExtendedMimeMessage((MimeMessage) source); }  }
MessageMimeMessageFactory extends AbstractMimeMessageFactory<MimeMessage> { @Override public MimeMessage createMessage(Object source, Map<String, Object> parameters) throws MessagingException { if (!(source instanceof MimeMessage)) { throw new MessagingException( String.format("Failed to create mime message from source [%s]", source.getClass())); } return new ExtendedMimeMessage((MimeMessage) source); }  @Override MimeMessage createMessage(Object source, Map<String, Object> parameters); }
MessageMimeMessageFactory extends AbstractMimeMessageFactory<MimeMessage> { @Override public MimeMessage createMessage(Object source, Map<String, Object> parameters) throws MessagingException { if (!(source instanceof MimeMessage)) { throw new MessagingException( String.format("Failed to create mime message from source [%s]", source.getClass())); } return new ExtendedMimeMessage((MimeMessage) source); }  @Override MimeMessage createMessage(Object source, Map<String, Object> parameters);  }