### Question:
RaceListConverter { public List<String> convert(RaceList raceList) { if (raceList == null) { return null; } return toSliRaceList(raceList.getRaces()); }  List<String> convert(RaceList raceList);  }### Answer:
@Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assertNull("Race list should be null", result); }
@Test public void testEmptyList() { RaceList list = new RaceList(); List<String> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@Test public void testConversion() { for (RaceType rt : map.keySet()) { RaceList rl = new RaceList(); Race r = new Race(); r.setCode(rt); rl.add(r); List<String> convertedList = converter.convert(rl); Assert.assertEquals(1, convertedList.size()); Assert.assertEquals(map.get(rt), convertedList.get(0)); } }
@Test public void testListConversion() { RaceList rl = new RaceList(); for (RaceType rt : map.keySet()) { Race r = new Race(); r.setCode(rt); rl.add(r); } List<String> convertedList = converter.convert(rl); List<String> expectedList = new ArrayList<String>(); expectedList.addAll(map.values()); Collections.sort(convertedList); Collections.sort(expectedList); Assert.assertEquals(expectedList.size(), convertedList.size()); for (int i = 0; i < expectedList.size(); i++) { Assert.assertEquals(expectedList.get(i), convertedList.get(i)); } }