### Question:
EmailListConverter { public List<ElectronicMail> convert(EmailList list) { if (list == null) { return null; } List<ElectronicMail> result = new ArrayList<ElectronicMail>(); for (Email sifEmail : list) { ElectronicMail sliEmail = new ElectronicMail(); sliEmail.setEmailAddress(sifEmail.getValue()); result.add(sliEmail); } return result; }  List<ElectronicMail> convert(EmailList list);  }### Answer:
@Test public void testNullObject() { List<ElectronicMail> result = converter.convert(null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { EmailList list = new EmailList(); List<ElectronicMail> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyEmail() { EmailList list = new EmailList(); list.add(new Email()); List<ElectronicMail> result = converter.convert(list); Assert.assertEquals(1, result.size()); ElectronicMail sliEmail = result.get(0); Assert.assertNull(sliEmail.getEmailAddressType()); Assert.assertNull(sliEmail.getEmailAddress()); }
@Test public void testMappings() { EmailList emails = createEmailList(); List<ElectronicMail> result = converter.convert(emails); Assert.assertEquals("Should map 5 emails", 5, result.size()); for (int i = 0; i < 5; i++) { Assert.assertNotNull(result.get(i)); Assert.assertEquals(result.get(i).getEmailAddress(), "email" + i); Assert.assertEquals(result.get(i).getEmailAddressType(), null); } }