@Test public void testEnhanceStudent() { GenericEntity entity = new GenericEntity(); entity.put("gradeLevel", "Adult Education"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "AE"); entity = new GenericEntity(); entity.put("gradeLevel", "Early Education"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "EE"); entity = new GenericEntity(); entity.put("gradeLevel", "Eighth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "8"); entity = new GenericEntity(); entity.put("gradeLevel", "Eleventh grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "11"); entity = new GenericEntity(); entity.put("gradeLevel", "Fifth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "5"); entity = new GenericEntity(); entity.put("gradeLevel", "First grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "1"); entity = new GenericEntity(); entity.put("gradeLevel", "Fourth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "4"); entity = new GenericEntity(); entity.put("gradeLevel", "Grade 13"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "13"); entity = new GenericEntity(); entity.put("gradeLevel", "Infant/toddler"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "IN"); entity = new GenericEntity(); entity.put("gradeLevel", "Kindergarten"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "K"); entity = new GenericEntity(); entity.put("gradeLevel", "Ninth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "9"); entity = new GenericEntity(); entity.put("gradeLevel", "Other"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "O"); entity = new GenericEntity(); entity.put("gradeLevel", "Postsecondary"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "+S"); entity = new GenericEntity(); entity.put("gradeLevel", "Preschool/Prekindergarten"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "PK"); entity = new GenericEntity(); entity.put("gradeLevel", "Second grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "2"); entity = new GenericEntity(); entity.put("gradeLevel", "Seventh grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "7"); entity = new GenericEntity(); entity.put("gradeLevel", "Sixth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "6"); entity = new GenericEntity(); entity.put("gradeLevel", "Tenth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "10"); entity = new GenericEntity(); entity.put("gradeLevel", "Third grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "3"); entity = new GenericEntity(); entity.put("gradeLevel", "Transitional Kindergarten"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "TK"); entity = new GenericEntity(); entity.put("gradeLevel", "Twelfth grade"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "12"); entity = new GenericEntity(); entity.put("gradeLevel", "Ungraded"); entity = GenericEntityEnhancer.enhanceStudent(entity); Assert.assertEquals(entity.get("gradeLevelCode"), "UG"); entity = new GenericEntity(); entity = GenericEntityEnhancer.enhanceStudentSchoolAssociation(entity); Assert.assertNull(entity.get("gradeLevelCode")); }
public static GenericEntity enhanceStudent(GenericEntity entity) { String gradeLevel = entity.getString("gradeLevel"); if (gradeLevel != null && gradeConversion.containsKey(gradeLevel)) { entity.put("gradeLevelCode", gradeConversion.get(gradeLevel)); } return entity; }
GenericEntityEnhancer { public static GenericEntity enhanceStudent(GenericEntity entity) { String gradeLevel = entity.getString("gradeLevel"); if (gradeLevel != null && gradeConversion.containsKey(gradeLevel)) { entity.put("gradeLevelCode", gradeConversion.get(gradeLevel)); } return entity; } }
GenericEntityEnhancer { public static GenericEntity enhanceStudent(GenericEntity entity) { String gradeLevel = entity.getString("gradeLevel"); if (gradeLevel != null && gradeConversion.containsKey(gradeLevel)) { entity.put("gradeLevelCode", gradeConversion.get(gradeLevel)); } return entity; }  }
GenericEntityEnhancer { public static GenericEntity enhanceStudent(GenericEntity entity) { String gradeLevel = entity.getString("gradeLevel"); if (gradeLevel != null && gradeConversion.containsKey(gradeLevel)) { entity.put("gradeLevelCode", gradeConversion.get(gradeLevel)); } return entity; }  static GenericEntity enhanceStudent(GenericEntity entity); @SuppressWarnings({ "rawtypes", "unchecked" }) static Map convertGradeLevel(Map entity, String elementName); static String convertGradeLevel(String gradeLevel); static GenericEntity enhanceStudentSchoolAssociation(GenericEntity entity); }
GenericEntityEnhancer { public static GenericEntity enhanceStudent(GenericEntity entity) { String gradeLevel = entity.getString("gradeLevel"); if (gradeLevel != null && gradeConversion.containsKey(gradeLevel)) { entity.put("gradeLevelCode", gradeConversion.get(gradeLevel)); } return entity; }  static GenericEntity enhanceStudent(GenericEntity entity); @SuppressWarnings({ "rawtypes", "unchecked" }) static Map convertGradeLevel(Map entity, String elementName); static String convertGradeLevel(String gradeLevel); static GenericEntity enhanceStudentSchoolAssociation(GenericEntity entity);  }