Skip to content

Commit

Permalink
Add tests for Utils.createEmptyBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
lincmba committed Sep 20, 2024
1 parent fbf9db5 commit 79c840f
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.hl7.fhir.r4.model.Base64BinaryType;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Composition;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Reference;
Expand All @@ -16,6 +17,19 @@

public class UtilsTest {

@Test
public void testCreateEmptyBundle() {
String requestURL = "http://example.com/fhir/Bundle";
Bundle result = Utils.createEmptyBundle(requestURL);
Assert.assertNotNull(result);
Assert.assertNotNull(result.getId());
Assert.assertEquals(0, result.getTotal());
Assert.assertEquals(Bundle.BundleType.SEARCHSET, result.getType());
Assert.assertEquals(1, result.getLink().size());
Assert.assertEquals(Bundle.LINK_SELF, result.getLink().get(0).getRelation());
Assert.assertEquals(requestURL, result.getLink().get(0).getUrl());
}

@Test
public void testGetBinaryResourceReferenceWithNullComposition() {
String result = Utils.getBinaryResourceReference(null);
Expand Down Expand Up @@ -141,7 +155,6 @@ public void testFindSyncStrategyWithMultipleSyncStrategies() {
binary.setDataElement(new Base64BinaryType(encodedJson));

String result = Utils.findSyncStrategy(binary);

Assert.assertEquals("PUSH", result);
}
}

0 comments on commit 79c840f

Please sign in to comment.