### Question:
GradeLevelsConverter { public List<String> convert(GradeLevels source) { if (source == null) { return null; } return toSliGradeList(source.getGradeLevels()); }  List<String> convert(GradeLevels source); String convert(GradeLevel source);  }### Answer:
@Test public void testNullObject() { List<String> result = converter.convert((GradeLevels) null); Assert.assertNull("Grade levels list should be null", result); }
@Test public void testEmptyList() { GradeLevels list = new GradeLevels(); list.setGradeLevels(new GradeLevel[0]); List<String> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyGradeLevel() { GradeLevels list = new GradeLevels(); GradeLevel original = new GradeLevel(); list.add(original); List<String> result = converter.convert(list); Assert.assertEquals(1, result.size()); String gradeLevel = result.get(0); Assert.assertEquals("Not Available", gradeLevel); }
@Test public void testMappings() { map.clear(); map.put(GradeLevelCode._01, "First grade"); map.put(GradeLevelCode._02, "Second grade"); map.put(GradeLevelCode._03, "Third grade"); map.put(GradeLevelCode._04, "Fourth grade"); map.put(GradeLevelCode._05, "Fifth grade"); map.put(GradeLevelCode._06, "Sixth grade"); map.put(GradeLevelCode._07, "Seventh grade"); map.put(GradeLevelCode._08, "Eighth grade"); map.put(GradeLevelCode._09, "Ninth grade"); map.put(GradeLevelCode._10, "Tenth grade"); map.put(GradeLevelCode._11, "Eleventh grade"); map.put(GradeLevelCode._12, "Twelfth grade"); map.put(GradeLevelCode.KG, "Kindergarten"); map.put(GradeLevelCode.OTHER, "Other"); map.put(GradeLevelCode.PG, "Postsecondary"); map.put(GradeLevelCode.PK, "Preschool/Prekindergarten"); map.put(GradeLevelCode.UN, "Ungraded"); map.put(GradeLevelCode.UNKNOWN, "Not Available"); GradeLevels list = getGradeLevels(); List<String> results = converter.convert(list); Assert.assertEquals(list.size(), results.size()); int newCounter = 0; for (String gradeLevel : results) { Assert.assertNotNull(gradeLevel); GradeLevel original = list.get(newCounter++); testMapping(original.getCode(), gradeLevel); } }