### Question:
Mailer { public void notifyStored(SPProgramID progId, AuxFileType type, String fileName) throws MessagingException { MimeMessage msg = createMessage(progId, type); StringBuilder buf = new StringBuilder(); buf.append(type.getDisplayName()); buf.append(" file uploaded for program "); buf.append(progId.stringValue()); msg.setSubject(buf.toString()); buf = new StringBuilder(); buf.append("An auxiliary file ("); buf.append(type.getDisplayName()); buf.append(") has been uploaded or modified for program "); buf.append(progId.stringValue()).append(":\n\n"); buf.append("\t").append(fileName); msg.setText(buf.toString()); _transport.send(msg); } Mailer(MailConfig config, IDBDatabaseService odb);  Mailer(MailConfig config, IDBDatabaseService odb, MailTransport transport); void notifyStored(SPProgramID progId, AuxFileType type, String fileName); void notifyChecked(SPProgramID progId, AuxFileType type,
			String fileName, boolean checked);  }### Answer:
@Test public void testEmptyConfigWithCS() throws Exception { progBuilder.cs("swalker2m@yahoo.com").build(); Mailer m = new Mailer(mailConfigBuilder.build(), odb, transport); m.notifyStored(progId, AuxFileType.other, "TestFinder.jpg"); Message msg = transport.getMessage(); Address[] addrs = msg.getRecipients(Message.RecipientType.TO); assertEquals(addrs.length, 1); assertEquals(addrs[0].toString(), "swalker2m@yahoo.com"); }
@Test public void testConfigWithCS() throws Exception { List<InternetAddress> finderRecipients = new ArrayList<InternetAddress>(); finderRecipients.add(new InternetAddress("swalker2m@mac.com")); mailConfigBuilder.finderRecipients(finderRecipients); progBuilder.cs("swalker2m@yahoo.com").build(); Mailer m = new Mailer(mailConfigBuilder.build(), odb, transport); m.notifyStored(progId, AuxFileType.other, "TestFinder.jpg"); Set<String> addrs = hashAddresses(Message.RecipientType.TO); assertEquals(addrs.size(), 2); assertTrue(addrs.contains("swalker2m@yahoo.com")); assertTrue(addrs.contains("swalker2m@mac.com")); }
@Test public void testEmptyConfigNoCS() throws Exception { progBuilder.ngo("swalker2m@yahoo.com").build(); Mailer m = new Mailer(mailConfigBuilder.build(), odb, transport); m.notifyStored(progId, AuxFileType.other, "TestFinder.jpg"); Set<String> addrs = hashAddresses(Message.RecipientType.TO); assertEquals(addrs.size(), 1); assertTrue(addrs.contains("swalker2m@yahoo.com")); }