CDAHelper { public static String getDatatypesValue(Integer datatypeId,Obs obs) { String value = ""; if(datatypeId!=null && obs!=null) { switch(datatypeId) { case 1: long longvalue=Math.round(obs.getValueNumeric()); int intvalue=(int)longvalue; value=String.valueOf(intvalue); break; case 2: value = obs.getValueCoded().getDisplayString(); break; case 3: value = obs.getValueText(); break; case 6: value =removeDirtyValue( obs.getValueDate().toString()); break; case 7: value = obs.getValueTime().toString(); break; case 8: value = obs.getValueDatetime().toString(); break; case 10: value = obs.getValueAsBoolean().toString(); break; case 13: value = obs.getValueComplex(); break; } } return value; }  static SimpleDateFormat getDateFormat(); static IVL_TS buildEffectiveTimeinIVL(Date d , Date d1); static IVL_TS buildEffectiveTimeinIVL(Date d); static II buildTemplateID(String root , String extension ,String assigningAuthorityName); static ST buildTitle(String title); static II buildID(String root , String extension); static CE buildCodeCE(String code , String codeSystem, String displayString, String codeSystemName); static CD buildCodeCD(String code , String codeSystem, String displayString, String codeSystemName); static TS buildEffectiveTime(Date d); static ED buildEDText(String value); static String getDatatypesValue(Integer datatypeId,Obs obs); static Obs getLatestObs(List<Obs> observationList); static CS getStatusCode(String statusCode); static IVL_TS buildDateTime(Date date); static String getCodeSystemByName(String codeSystemName); static String removeDirtyValue(String input); static String getUnitsaccordingto_Tf_PCC(String unit); static String getConceptIdasString(int conceptId);  }
@Test public void shouldContainEmptyValueIfGetDatatypesValueIsPassedWithNullValues() { String value1=CDAHelper.getDatatypesValue(null, null); Assert.assertEquals(value1, ""); }