Skip to content

Commit

Permalink
FLAG-79: fixed the build fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ManojLL committed Jul 30, 2024
1 parent 07bfd95 commit e6e63a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void setup() throws Exception {

@Test
public void eval_shouldEvaluateFLag() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);
Patient patient = Context.getService(PatientService.class).getPatient(2);
Map<Object, Object> context = new HashMap<>();

Expand All @@ -49,15 +49,15 @@ public void eval_shouldEvaluateFLag() {

@Test(expected = APIException.class)
public void eval_shouldThrowApiExceptionWhenPatientIsVoided() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);
Patient patient = Context.getService(PatientService.class).getPatient(1);
Map<Object, Object> context = new HashMap<>();
groovyFlagEvaluator.eval(flag, patient, context);
}

@Test
public void evalCohort_shouldReturnCohortWithNullCohortParameter() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);
Map<Object, Object> context = new HashMap<>();

Cohort resultCohort = groovyFlagEvaluator.evalCohort(flag, null, context);
Expand All @@ -68,7 +68,7 @@ public void evalCohort_shouldReturnCohortWithNullCohortParameter() {

@Test
public void evalCohort_shouldReturnCohortWithCohortParameter() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);
Map<Object, Object> context = new HashMap<>();

Cohort cohort = new Cohort();
Expand All @@ -90,7 +90,7 @@ public void evalCohort_shouldThrowsException() {

@Test
public void validate_shouldReturnFlagValidationResult() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);

FlagValidationResult result = groovyFlagEvaluator.validate(flag);
assertTrue(result.getResult());
Expand All @@ -106,7 +106,7 @@ public void validate_shouldReturnFalseResultWithLocalizedMessage() {

@Test
public void evalMessage_ShouldReturnMessage() {
Flag flag = Context.getService(FlagService.class).getFlag(3);
Flag flag = Context.getService(FlagService.class).getFlag(8);
Patient patient = Context.getService(PatientService.class).getPatient(2);

String message = groovyFlagEvaluator.evalMessage(flag, patient.getPatientId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<patientflags_flag flag_id="1" name="SQL Sample" evaluator="org.openmrs.module.patientflags.evaluator.SQLFlagEvaluator" criteria="select e.patient_id from encounter e where e.encounter_datetime > now()" message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
<patientflags_flag flag_id="2" name="Invalid SQL Sample" evaluator="org.openmrs.module.patientflags.evaluator.SQLFlagEvaluator" criteria="select * from encounter e where e.encounter_datetime > now()" message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
<patientflags_flag flag_id="3" name="Groovy Sample" evaluator="org.openmrs.module.patientflags.evaluator.GroovyFlagEvaluator" criteria="result = new Cohort(); result.addMember(2); return org.openmrs.Cohort.union(result, testCohort); " message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
<patientflags_flag flag_id="3" name="Groovy Sample" evaluator="org.openmrs.module.patientflags.evaluator.GroovyFlagEvaluator" criteria="return null" message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
<patientflags_flag flag_id="4" name="Invalid Groovy Sample" evaluator="org.openmrs.module.patientflags.evaluator.GroovyFlagEvaluator" criteria="bogus" message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
<patientflags_flag flag_id="8" name="Groovy Sample" evaluator="org.openmrs.module.patientflags.evaluator.GroovyFlagEvaluator" criteria="result = new Cohort(); result.addMember(2); return org.openmrs.Cohort.union(result, testCohort); " message="Test" enabled="1" creator="1" date_created="2005-09-22 00:00:00.0" retired="false" uuid="da7f524f-27ce-4bb2-86d6-6d1d05312bd5"/>
</dataset>

0 comments on commit e6e63a5

Please sign in to comment.