### Question:
AddressListConverter { public List<Address> convert(AddressList addressList) { if (addressList == null) { return null; } return toSliAddressList(addressList.getAddresses()); }  List<Address> convert(AddressList addressList); List<Address> convert(StudentAddressList addressList);  }### Answer:
@Test public void testNullObject() { List<Address> result = converter.convert((AddressList) null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { AddressList list = new AddressList(); List<Address> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyAddress() { AddressList list = new AddressList(); openadk.library.common.Address original = new openadk.library.common.Address(); list.add(original); List<Address> result = converter.convert(list); Assert.assertEquals(1, result.size()); Address address = result.get(0); Assert.assertEquals("Other", address.getAddressType()); Assert.assertNull(address.getCity()); Assert.assertNull(address.getCountryCode()); Assert.assertNull(address.getPostalCode()); Assert.assertNull(address.getStateAbbreviation()); Assert.assertNull(address.getStreetNumberName()); }
@Test public void testConversion() { map.clear(); map.put(AddressType._0369_CAMPUS, "Other"); map.put(AddressType._0369_EMPLOYER, "Other"); map.put(AddressType._0369_EMPLOYMENT, "Work"); map.put(AddressType._0369_MAILING, "Mailing"); map.put(AddressType._0369_ORGANIZATION, "Other"); map.put(AddressType._0369_OTHER, "Other"); map.put(AddressType._0369_PERMANENT, "Other"); map.put(AddressType.EMPLOYERS, "Other"); map.put(AddressType.EMPLOYMENT, "Work"); map.put(AddressType.MAILING, "Mailing"); map.put(AddressType.OTHER_HOME, "Home"); map.put(AddressType.OTHER_ORGANIZATION, "Other"); map.put(AddressType.PHYSICAL_LOCATION, "Physical"); map.put(AddressType.SHIPPING, "Other"); map.put(AddressType.SIF15_CAMPUS, "Other"); map.put(AddressType.SIF15_EMPLOYER, "Other"); map.put(AddressType.SIF15_EMPLOYMENT, "Work"); map.put(AddressType.SIF15_MAILING, "Mailing"); map.put(AddressType.SIF15_ORGANIZATION, "Other"); map.put(AddressType.SIF15_OTHER, "Other"); map.put(AddressType.SIF15_PERMANENT, "Other"); map.put(AddressType.wrap("something else"), "Other"); addressTypes.addAll(map.keySet()); AddressList originalList = new AddressList(); for (int i = 0; i < addressTypes.size(); i++) { openadk.library.common.Address address = getAddress(i); originalList.add(address); } List<Address> convertedList = converter.convert(originalList); Assert.assertEquals(originalList.size(), convertedList.size()); int i = 0; for (Address converted : convertedList) { openadk.library.common.Address original = originalList.get(i++); testMapping(original, converted); } }