### Question:
PhoneNumberListConverter { public List<InstitutionTelephone> convertInstitutionTelephone(PhoneNumberList phoneNumberList) { if (phoneNumberList == null) { return null; } return toSliInstitutionTelephoneList(phoneNumberList.getPhoneNumbers()); }  List<InstitutionTelephone> convertInstitutionTelephone(PhoneNumberList phoneNumberList); List<PersonalTelephone> convertPersonalTelephone(PhoneNumberList phoneNumberList);  }### Answer:
@Test public void testNullObject() { List<InstitutionTelephone> result = converter.convertInstitutionTelephone(null); Assert.assertNull("Telephone list should be null", result); }
@Test public void testEmptyList() { PhoneNumberList list = new PhoneNumberList(); list.setPhoneNumbers(new PhoneNumber[0]); List<InstitutionTelephone> result = converter.convertInstitutionTelephone(list); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyPhoneNumber() { PhoneNumberList list = new PhoneNumberList(); PhoneNumber original = new PhoneNumber(); list.add(original); List<InstitutionTelephone> result = converter.convertInstitutionTelephone(list); Assert.assertEquals(1, result.size()); InstitutionTelephone it = result.get(0); Assert.assertEquals(original.getNumber(), it.getTelephoneNumber()); Assert.assertEquals("Other", it.getInstitutionTelephoneNumberType()); }
@Test public void testMappings() { map.clear(); map.put(PhoneNumberType.ALT, "Other"); map.put(PhoneNumberType.ANSWERING_SERVICE, "Other"); map.put(PhoneNumberType.APPOINTMENT, "Other"); map.put(PhoneNumberType.BEEPER, "Other"); map.put(PhoneNumberType.FAX, "Fax"); map.put(PhoneNumberType.INSTANT_MESSAGING, "Other"); map.put(PhoneNumberType.MEDIA_CONFERENCE, "Other"); map.put(PhoneNumberType.PRIMARY, "Main"); map.put(PhoneNumberType.SIF1x_ALT, "Other"); map.put(PhoneNumberType.SIF1x_ANSWERING_SERVICE, "Other"); map.put(PhoneNumberType.SIF1x_APPT_NUMBER, "Other"); map.put(PhoneNumberType.SIF1x_BEEPER, "Other"); map.put(PhoneNumberType.SIF1x_EXT, "Other"); map.put(PhoneNumberType.SIF1x_HOME_FAX, "Fax"); map.put(PhoneNumberType.SIF1x_HOME_PHONE, "Other"); map.put(PhoneNumberType.SIF1x_NIGHT_PHONE, "Other"); map.put(PhoneNumberType.SIF1x_OTHER_RES_FAX, "Other"); map.put(PhoneNumberType.SIF1x_OTHER_RES_PHONE, "Other"); map.put(PhoneNumberType.SIF1x_PERSONAL_CELL, "Other"); map.put(PhoneNumberType.SIF1x_PERSONAL_PHONE, "Other"); map.put(PhoneNumberType.SIF1x_TELEMAIL, "Other"); map.put(PhoneNumberType.SIF1x_TELEX, "Other"); map.put(PhoneNumberType.SIF1x_VOICEMAIL, "Other"); map.put(PhoneNumberType.SIF1x_WORK_CELL, "Other"); map.put(PhoneNumberType.SIF1x_WORK_FAX, "Other"); map.put(PhoneNumberType.SIF1x_WORK_PHONE, "Other"); map.put(PhoneNumberType.TELEMAIL, "Other"); map.put(PhoneNumberType.TELEX, "Other"); map.put(PhoneNumberType.VOICE_MAIL, "Other"); PhoneNumberList list = getPhoneNumberList(); List<InstitutionTelephone> results = converter.convertInstitutionTelephone(list); Assert.assertEquals(list.size(), results.size()); int newCounter = 0; for (InstitutionTelephone it : results) { Assert.assertNotNull(it); PhoneNumber original = list.get(newCounter++); testMapping(original, it); } }