mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 06:14:45 +00:00
Add tests
This commit is contained in:
parent
da95cae662
commit
0d07993186
@ -0,0 +1,35 @@
|
||||
package org.hl7.fhir.convertors.conv10_30;
|
||||
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Bundle10_30Test {
|
||||
|
||||
@Test
|
||||
@DisplayName("Test 10_30 bundle conversion when resource is null")
|
||||
public void testNoResourceBundleConversion() throws IOException {
|
||||
org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent()
|
||||
.setRequest(
|
||||
new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent()
|
||||
.setMethod(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE)
|
||||
.setUrl("Patient?identifier=123456")
|
||||
);
|
||||
|
||||
org.hl7.fhir.dstu3.model.Bundle stu3Bundle = new org.hl7.fhir.dstu3.model.Bundle()
|
||||
.addEntry(bec);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_30.convertResource(stu3Bundle);
|
||||
Assertions.assertNotNull(dstu2Resource);
|
||||
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
|
||||
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
|
||||
|
||||
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.hl7.fhir.convertors.conv10_40;
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Bundle10_40Test {
|
||||
|
||||
@Test
|
||||
@DisplayName("Test 10_40 bundle conversion when resource is null")
|
||||
public void testNoResourceBundleConversion() throws IOException {
|
||||
org.hl7.fhir.r4.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.r4.model.Bundle.BundleEntryComponent()
|
||||
.setRequest(
|
||||
new org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent()
|
||||
.setMethod(org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE)
|
||||
.setUrl("Patient?identifier=123456")
|
||||
);
|
||||
|
||||
org.hl7.fhir.r4.model.Bundle r4Bundle = new org.hl7.fhir.r4.model.Bundle()
|
||||
.addEntry(bec);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_40.convertResource(r4Bundle);
|
||||
Assertions.assertNotNull(dstu2Resource);
|
||||
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
|
||||
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
|
||||
|
||||
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.hl7.fhir.convertors.conv10_50;
|
||||
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Bundle10_50Test {
|
||||
|
||||
@Test
|
||||
@DisplayName("Test 10_50 bundle conversion when resource is null")
|
||||
public void testNoResourceBundleConversion() throws IOException {
|
||||
org.hl7.fhir.r5.model.Bundle.BundleEntryComponent bec = new org.hl7.fhir.r5.model.Bundle.BundleEntryComponent()
|
||||
.setRequest(
|
||||
new org.hl7.fhir.r5.model.Bundle.BundleEntryRequestComponent()
|
||||
.setMethod(org.hl7.fhir.r5.model.Bundle.HTTPVerb.DELETE)
|
||||
.setUrl("Patient?identifier=123456")
|
||||
);
|
||||
|
||||
org.hl7.fhir.r5.model.Bundle r5Bundle = new org.hl7.fhir.r5.model.Bundle()
|
||||
.addEntry(bec);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Resource dstu2Resource = VersionConvertorFactory_10_50.convertResource(r5Bundle);
|
||||
Assertions.assertNotNull(dstu2Resource);
|
||||
Assertions.assertTrue(dstu2Resource instanceof org.hl7.fhir.dstu2.model.Bundle);
|
||||
|
||||
org.hl7.fhir.dstu2.model.Bundle dstu2Bundle = (org.hl7.fhir.dstu2.model.Bundle) dstu2Resource;
|
||||
Assertions.assertEquals(1, dstu2Bundle.getEntry().size());
|
||||
|
||||
Assertions.assertNull(dstu2Bundle.getEntry().get(0).getResource());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user