### Question:
SmtpTask implements Task { @Deprecated public void send(String hostName, int port, String from, String to, String subject, String message, String bcc) throws Exception { Map<String, Object> smtp = new HashMap<>(); smtp.put(Constants.HOST_KEY, hostName); smtp.put(Constants.PORT_KEY, port); Map<String, Object> mail = new HashMap<>(); mail.put(Constants.FROM_KEY, from); mail.put(Constants.TO_KEY, to); mail.put(Constants.SUBJECT_KEY, subject); mail.put(Constants.MESSAGE_KEY, message); mail.put(Constants.BCC_KEY, bcc); send(null, smtp, mail); }  @Override void execute(Context ctx); @Deprecated void call(@InjectVariable("context") Context ctx, Map<String, Object> smtpParams, Map<String, Object> mailParams); @Deprecated void call(Map<String, Object> smtpParams, Map<String, Object> mailParams); @Deprecated void send(String hostName, int port, String from, String to, String subject, String message, String bcc);  }### Answer:
@Test public void test() throws Exception { SmtpServer server = mail.getSmtp(); SmtpTask t = new SmtpTask(); t.send("localhost", server.getPort(), "my@mail.com", "their@mail.com", "test", "Hello!", "another@mail.com"); MimeMessage[] messages = mail.getReceivedMessages(); assertEquals(2, messages.length); assertEquals("Hello!\r\n", messages[0].getContent()); mail.reset(); }
@Test public void testNoBcc() throws Exception { SmtpServer server = mail.getSmtp(); SmtpTask t = new SmtpTask(); t.send("localhost", server.getPort(), "my@mail.com", "their@mail.com", "test", "Hello!", null); MimeMessage[] messages = mail.getReceivedMessages(); assertEquals(1, messages.length); assertEquals("Hello!\r\n", messages[0].getContent()); assertEquals(1, messages[0].getAllRecipients().length); mail.reset(); }