package de.techdev.trackr.core.mail.support;

import lombok.extern.slf4j.Slf4j;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessagePreparator;

import javax.mail.internet.MimeMessage;
import java.io.InputStream;

/**
 * Mock class to be used by Spring Integration for dev and qs.
 *
 * @author Moritz Schulze
 */
@Slf4j
public class NoOpJavaMailSender implements JavaMailSender {

    @Override
    public MimeMessage createMimeMessage() {
        log.debug("Create mime message");
        return null;
    }

    @Override
    public MimeMessage createMimeMessage(InputStream contentStream) {
        log.debug("Create Mime message with stream");
        return null;
    }

    @Override
    public void send(MimeMessage mimeMessage) {
        log.debug("Send single mime message");
    }

    @Override
    public void send(MimeMessage[] mimeMessages) {
        log.debug("Send multiple mime messages");
    }

    @Override
    public void send(MimeMessagePreparator mimeMessagePreparator) {
        log.debug("Send mime message preparator");
    }

    @Override
    public void send(MimeMessagePreparator[] mimeMessagePreparators) {
        log.debug("Send multiple mime message preparators");
    }

    @Override
    public void send(SimpleMailMessage simpleMessage) {
        log.debug("Send simple mail message");
    }

    @Override
    public void send(SimpleMailMessage[] simpleMessages) {
        log.debug("Send multiple simple messages");
    }
}

@@ -313,16 +313,41 @@
 tStream;
+%0Aimport java.util.Arrays;
 %0A%0A/**%0A *
@@ -436,16 +436,46 @@
 Schulze%0A
+ * @author Alexander Hanschke%0A
  */%0A@Slf
@@ -1446,44 +1446,535 @@
     
-log.debug(%22Send simple mail message%22
+StringBuilder builder = new StringBuilder(%22Send simple mail message..%5Cn%22);%0A        builder%0A                .append(%22From:    %22).append(simpleMessage.getFrom()).append(%22%5Cn%22)%0A                .append(%22To:      %22).append(Arrays.toString(simpleMessage.getTo())).append(%22%5Cn%22)%0A                .append(%22Subject: %22).append(simpleMessage.getSubject()).append(%22%5Cn%22)%0A                .append(%22--------------------------------------------%22).append(%22%5Cn%22)%0A                .append(simpleMessage.getText());%0A%0A        log.debug(builder.toString()
 );%0A 

make NoOpJavaMailSender chattier