Merge pull request #259 from nrpeterson/boundcodeableconcept-serialization

Add serializability for BoundCodeableConceptDt
This commit is contained in:
James Agnew 2015-11-26 06:59:14 -05:00
commit a046afe1d0
3 changed files with 21 additions and 2 deletions

View File

@ -20,6 +20,8 @@ package ca.uhn.fhir.model.api;
* #L% * #L%
*/ */
public interface IBoundCodeableConcept { import java.io.Serializable;
public interface IBoundCodeableConcept extends Serializable {
} }

View File

@ -21,8 +21,9 @@ package ca.uhn.fhir.model.api;
*/ */
import java.io.Serializable;
public interface IValueSetEnumBinder<T extends Enum<?>> { public interface IValueSetEnumBinder<T extends Enum<?>> extends Serializable {
T fromCodeString(String theCodeString); T fromCodeString(String theCodeString);

View File

@ -17,6 +17,7 @@ import ca.uhn.fhir.model.dstu2.composite.AddressDt;
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.MaritalStatusCodesEnum;
import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.parser.IParser;
public class ModelSerializationTest { public class ModelSerializationTest {
@ -55,4 +56,19 @@ public class ModelSerializationTest {
} }
/**
* Verify that MaritalStatusCodeEnum (and, by extension, BoundCodeableConcepts in general) are serializable.
* Author: Nick Peterson (nrpeterson@gmail.com)
*/
@Test
public void testBoundCodeableConceptSerialization() {
MaritalStatusCodesEnum maritalStatus = MaritalStatusCodesEnum.M;
byte[] bytes = SerializationUtils.serialize(maritalStatus);
assertTrue(bytes.length > 0);
MaritalStatusCodesEnum deserialized = SerializationUtils.deserialize(bytes);
assertEquals(maritalStatus.getCode(), deserialized.getCode());
assertEquals(maritalStatus.getSystem(), deserialized.getSystem());
}
} }