-
Notifications
You must be signed in to change notification settings - Fork 657
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #465 from synthetichealth/flapping_test
Fix #454 intermittent failures.
- Loading branch information
Showing
2 changed files
with
114 additions
and
9 deletions.
There are no files selected for viewing
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
102 changes: 102 additions & 0 deletions
102
src/test/java/org/mitre/synthea/modules/EncounterModuleTest.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,102 @@ | ||
package org.mitre.synthea.modules; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mitre.synthea.world.agents.Person; | ||
import org.mitre.synthea.world.agents.Provider; | ||
import org.mitre.synthea.world.concepts.HealthRecord.Encounter; | ||
import org.mitre.synthea.world.geography.Location; | ||
|
||
public class EncounterModuleTest { | ||
|
||
private Location location; | ||
private Person person; | ||
private EncounterModule module; | ||
|
||
/** | ||
* Setup the Encounter Module Tests. | ||
* @throws IOException on loading error | ||
*/ | ||
@Before | ||
public void setup() throws IOException { | ||
person = new Person(0L); | ||
location = new Location("Massachusetts", null); | ||
location.assignPoint(person, location.randomCityName(person.random)); | ||
Provider.loadProviders(location); | ||
module = new EncounterModule(); | ||
} | ||
|
||
@Test | ||
public void testEmergencyEncounterHasClinician() { | ||
EncounterModule.emergencyEncounter(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
|
||
@Test | ||
public void testUrgentcareEncounterHasClinician() { | ||
EncounterModule.urgentCareEncounter(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
|
||
@Test | ||
public void testEncounterHasClinician() { | ||
module.process(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
|
||
@Test | ||
public void testEmergencySymptomEncounterHasClinician() { | ||
person.setSymptom("Test", "Test", EncounterModule.EMERGENCY_SYMPTOM_THRESHOLD + 1, false); | ||
module.process(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
|
||
@Test | ||
public void testUrgentcareSymptomEncounterHasClinician() { | ||
person.setSymptom("Test", "Test", EncounterModule.URGENT_CARE_SYMPTOM_THRESHOLD + 1, false); | ||
module.process(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
|
||
@Test | ||
public void testPrimarySymptomEncounterHasClinician() { | ||
person.setSymptom("Test", "Test", EncounterModule.PCP_SYMPTOM_THRESHOLD + 1, false); | ||
module.process(person, System.currentTimeMillis()); | ||
assertNotNull(person.record); | ||
assertFalse(person.record.encounters.isEmpty()); | ||
int last = person.record.encounters.size() - 1; | ||
Encounter encounter = person.record.encounters.get(last); | ||
assertNotNull("Encounter must have clinician", encounter.clinician); | ||
assertNotNull("Encounter must have provider organization", encounter.provider); | ||
} | ||
} |