This commit is contained in:
jamesagnew 2015-07-26 18:07:48 -04:00
parent e457366ffa
commit b2e17dd746
1 changed files with 16 additions and 0 deletions

View File

@ -59,6 +59,7 @@ import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.resource.Profile;
import ca.uhn.fhir.model.dstu.resource.Query;
import ca.uhn.fhir.model.dstu.resource.Questionnaire;
import ca.uhn.fhir.model.dstu.resource.Remittance;
import ca.uhn.fhir.model.dstu.resource.Specimen;
import ca.uhn.fhir.model.dstu.resource.ValueSet;
import ca.uhn.fhir.model.dstu.resource.ValueSet.Define;
@ -115,6 +116,21 @@ public class JsonParserTest {
assertEquals(number, parsed.getPosition().getLatitude().getValueAsString());
}
@Test
public void testDecimalPrecisionPreservedInResource() {
Remittance obs = new Remittance();
obs.addService().setRate(new DecimalDt("0.10000"));
String output = ourCtx.newJsonParser().encodeResourceToString(obs);
ourLog.info(output);
assertEquals("{\"resourceType\":\"Remittance\",\"service\":[{\"rate\":0.10000}]}", output);
obs = ourCtx.newJsonParser().parseResource(Remittance.class, output);
assertEquals("0.10000", obs.getService().get(0).getRate().getValueAsString());
}
@Test
public void testParseStringWithNewlineUnencoded() {
Observation obs = new Observation();