CDAHelper { public static IVL_TS buildEffectiveTimeinIVL(Date d , Date d1) { IVL_TS effectiveTime = DatatypesFactory.eINSTANCE.createIVL_TS(); SimpleDateFormat s = new SimpleDateFormat("yyyyMMddhhmmss"); String creationDate; IVXB_TS low = DatatypesFactory.eINSTANCE.createIVXB_TS(); IVXB_TS high = DatatypesFactory.eINSTANCE.createIVXB_TS(); if(d!=null) { creationDate = s.format(d); low.setValue(creationDate); } else low.setNullFlavor(NullFlavor.UNK); effectiveTime.setLow(low); if(d1!=null) { high.setValue(s.format(d1)); } else high.setNullFlavor(NullFlavor.UNK); effectiveTime.setHigh(high); return effectiveTime; }  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 shouldPassIfBuildEffectiveTimeinIVLIsCalledNullValues() { IVL_TS time=CDAHelper.buildEffectiveTimeinIVL(null, null); IVXB_TS low=time.getLow(); IVXB_TS high=time.getHigh(); NullFlavor nf=low.getNullFlavor(); NullFlavor nf1=high.getNullFlavor(); Assert.assertNotNull(nf); Assert.assertNotNull(nf1); }
@Test public void shouldPassIfBuildEffectiveTimeinIVLIsCalledBothValues() { IVL_TS time=CDAHelper.buildEffectiveTimeinIVL(new Date(), new Date()); IVXB_TS low=time.getLow(); IVXB_TS high=time.getHigh(); String value=low.getValue(); String value1=high.getValue(); Assert.assertNotNull(value); Assert.assertNotNull(value1); }
@Test public void shouldPassIfBuildEffectiveTimeinIVLIsCalledOneValues() { IVL_TS time=CDAHelper.buildEffectiveTimeinIVL(new Date(), null); IVL_TS time1=CDAHelper.buildEffectiveTimeinIVL(null, new Date()); IVXB_TS low=time.getLow(); IVXB_TS high=time.getHigh(); IVXB_TS low1=time1.getLow(); IVXB_TS high1=time1.getHigh(); String value=low.getValue(); NullFlavor nf=high.getNullFlavor(); NullFlavor nf1=low1.getNullFlavor(); String value1=high1.getValue(); Assert.assertNotNull(value); Assert.assertNotNull(nf); Assert.assertNotNull(nf1); Assert.assertNotNull(value1); }