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