@Test public void when_subject_is_set_and_two_target_to_only_those_parts_are_in_result() { when(message.getSubject()).thenReturn("subject from test"); when(message.getTo()).thenReturn(new String[] { "test1@example.com", "test2@example.com" }); String result = supportToTest.describeTopic(message); assertEquals("subject=subject from test; to=test1@example.com,test2@example.com;", result); }
public String describeTopic(SimpleMailMessage message) { StringBuilder sb = new StringBuilder(); sb.append("subject=").append(message.getSubject()).append("; "); appendTargets(sb, message.getTo(), "to"); appendTargets(sb, message.getCc(), "cc"); appendTargets(sb, message.getBcc(), "bcc"); appendTarget(sb, message.getFrom(), "from"); appendTarget(sb, message.getReplyTo(), "replyTo"); return sb.toString().trim(); }
SimpleMailMessageSupport { public String describeTopic(SimpleMailMessage message) { StringBuilder sb = new StringBuilder(); sb.append("subject=").append(message.getSubject()).append("; "); appendTargets(sb, message.getTo(), "to"); appendTargets(sb, message.getCc(), "cc"); appendTargets(sb, message.getBcc(), "bcc"); appendTarget(sb, message.getFrom(), "from"); appendTarget(sb, message.getReplyTo(), "replyTo"); return sb.toString().trim(); } }
SimpleMailMessageSupport { public String describeTopic(SimpleMailMessage message) { StringBuilder sb = new StringBuilder(); sb.append("subject=").append(message.getSubject()).append("; "); appendTargets(sb, message.getTo(), "to"); appendTargets(sb, message.getCc(), "cc"); appendTargets(sb, message.getBcc(), "bcc"); appendTarget(sb, message.getFrom(), "from"); appendTarget(sb, message.getReplyTo(), "replyTo"); return sb.toString().trim(); }  }
SimpleMailMessageSupport { public String describeTopic(SimpleMailMessage message) { StringBuilder sb = new StringBuilder(); sb.append("subject=").append(message.getSubject()).append("; "); appendTargets(sb, message.getTo(), "to"); appendTargets(sb, message.getCc(), "cc"); appendTargets(sb, message.getBcc(), "bcc"); appendTarget(sb, message.getFrom(), "from"); appendTarget(sb, message.getReplyTo(), "replyTo"); return sb.toString().trim(); }  String describeTopic(SimpleMailMessage message); }
SimpleMailMessageSupport { public String describeTopic(SimpleMailMessage message) { StringBuilder sb = new StringBuilder(); sb.append("subject=").append(message.getSubject()).append("; "); appendTargets(sb, message.getTo(), "to"); appendTargets(sb, message.getCc(), "cc"); appendTargets(sb, message.getBcc(), "bcc"); appendTarget(sb, message.getFrom(), "from"); appendTarget(sb, message.getReplyTo(), "replyTo"); return sb.toString().trim(); }  String describeTopic(SimpleMailMessage message);  }