Trying to remove empty text node
This commit is contained in:
parent
5310d684df
commit
e18433d709
|
@ -44,6 +44,11 @@ public class CodeDt extends BasePrimitive<String> implements ICodedDatatype, Com
|
|||
setValue(theCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return isBlank(getValueAsString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CodeDt theCode) {
|
||||
if (theCode == null) {
|
||||
|
|
|
@ -48,6 +48,11 @@ public class XhtmlDt extends BasePrimitive<List<XMLEvent>> {
|
|||
// nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (getValue() == null || getValue().isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a string code
|
||||
*
|
||||
|
|
|
@ -108,14 +108,18 @@ public class JsonParserDstu2Test {
|
|||
public void testEncodeBundleNewBundleNoText() {
|
||||
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle b = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||
b.getText().getDiv();
|
||||
// b.getText().setDiv("<div>aaa</div>");
|
||||
b.getText().getStatus().setValueAsString("");;
|
||||
|
||||
Entry e = b.addEntry();
|
||||
e.setResource(new Patient());
|
||||
|
||||
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeResourceToString(b);
|
||||
ourLog.info(val);
|
||||
assertThat(val, not(containsString("text")));
|
||||
|
||||
val = new FhirContext().newXmlParser().setPrettyPrint(false).encodeResourceToString(b);
|
||||
ourLog.info(val);
|
||||
assertThat(val, not(containsString("text")));
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue