-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Issue #2377 - update ConstraintGenerator Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
- Loading branch information
Showing
5 changed files
with
5,993 additions
and
33 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...in-bb/src/test/java/com/ibm/fhir/ig/carin/bb/test/C4BBPatientConstraintGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2021 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.ig.carin.bb.test; | ||
|
||
import static org.testng.Assert.assertTrue; | ||
|
||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import com.ibm.fhir.model.annotation.Constraint; | ||
import com.ibm.fhir.model.format.Format; | ||
import com.ibm.fhir.model.parser.FHIRParser; | ||
import com.ibm.fhir.model.resource.StructureDefinition; | ||
import com.ibm.fhir.profile.ConstraintGenerator; | ||
|
||
public class C4BBPatientConstraintGeneratorTest { | ||
@Test | ||
public void testConstraintGenerator() throws Exception { | ||
InputStream in = C4BBPatientConstraintGeneratorTest.class.getClassLoader().getResourceAsStream("JSON/StructureDefinition-C4BB-Patient.json"); | ||
FHIRParser parser = FHIRParser.parser(Format.JSON); | ||
StructureDefinition profile = parser.parse(in); | ||
ConstraintGenerator generator = new ConstraintGenerator(profile); | ||
List<Constraint> constraints = generator.generate(); | ||
assertTrue(hasConstraint(constraints, "meta.where(lastUpdated.exists() and profile.where($this = 'http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient|1.0.0').count() = 1).exists()")); | ||
} | ||
|
||
public boolean hasConstraint(List<Constraint> constraints, String expr) { | ||
for (Constraint constraint : constraints) { | ||
if (constraint.expression().equals(expr)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
5,908 changes: 5,908 additions & 0 deletions
5,908
conformance/fhir-ig-carin-bb/src/test/resources/JSON/StructureDefinition-C4BB-Patient.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters