@Test public void shouldCreateEncounterEntityWithAppropriateValues() throws ProviderController.ProviderLoadException, FormController.FormFetchException { Date encounterDateTime = new Date(); final String formUuid = "formUuid"; String providerId = "providerId"; int locationId = 1; String userSystemId = "userSystemId"; final EncounterType encounterType = new EncounterType(){{ setUuid("encounterTypeForObservationsCreatedOnPhone"); }}; Form form = new Form(){{ setUuid(formUuid); setEncounterType(encounterType); }}; List<Provider> providers = new ArrayList<Provider>() {{ add(new Provider() {{ setUuid("provider1"); }}); }}; when(providerController.getAllProviders()).thenReturn(providers); when(formController.getFormByUuid(formUuid)).thenReturn(form); Encounter encounter = observationParserUtility.getEncounterEntity(encounterDateTime, formUuid,providerId, locationId, userSystemId, patient, formDataUuid); assertTrue(encounter.getUuid().startsWith("encounterUuid")); assertThat(encounter.getEncounterType().getUuid(), is(form.getEncounterType().getUuid())); assertThat(encounter.getProvider().getUuid(), is("providerForObservationsCreatedOnPhone")); assertThat(encounter.getEncounterDatetime(), is(encounterDateTime)); }
public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) { Encounter encounter = new Encounter(); encounter.setProvider(getDummyProvider(providerId)); encounter.setUuid(getEncounterUUID()); encounter.setLocation(getDummyLocation(locationId)); encounter.setEncounterType(getDummyEncounterType(formUuid)); encounter.setEncounterDatetime(encounterDateTime); encounter.setUserSystemId(userSystemId); encounter.setFormDataUuid(formDataUuid); encounter.setPatient(patient); return encounter; }
ObservationParserUtility { public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) { Encounter encounter = new Encounter(); encounter.setProvider(getDummyProvider(providerId)); encounter.setUuid(getEncounterUUID()); encounter.setLocation(getDummyLocation(locationId)); encounter.setEncounterType(getDummyEncounterType(formUuid)); encounter.setEncounterDatetime(encounterDateTime); encounter.setUserSystemId(userSystemId); encounter.setFormDataUuid(formDataUuid); encounter.setPatient(patient); return encounter; } }
ObservationParserUtility { public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) { Encounter encounter = new Encounter(); encounter.setProvider(getDummyProvider(providerId)); encounter.setUuid(getEncounterUUID()); encounter.setLocation(getDummyLocation(locationId)); encounter.setEncounterType(getDummyEncounterType(formUuid)); encounter.setEncounterDatetime(encounterDateTime); encounter.setUserSystemId(userSystemId); encounter.setFormDataUuid(formDataUuid); encounter.setPatient(patient); return encounter; } ObservationParserUtility(MuzimaApplication muzimaApplication, boolean createObservationsForConceptsNotAvailableLocally); }
ObservationParserUtility { public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) { Encounter encounter = new Encounter(); encounter.setProvider(getDummyProvider(providerId)); encounter.setUuid(getEncounterUUID()); encounter.setLocation(getDummyLocation(locationId)); encounter.setEncounterType(getDummyEncounterType(formUuid)); encounter.setEncounterDatetime(encounterDateTime); encounter.setUserSystemId(userSystemId); encounter.setFormDataUuid(formDataUuid); encounter.setPatient(patient); return encounter; } ObservationParserUtility(MuzimaApplication muzimaApplication, boolean createObservationsForConceptsNotAvailableLocally); Encounter getEncounterEntity(Date encounterDateTime,String  formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid); Concept getConceptEntity(String rawConceptName, boolean isCoded, boolean createConceptIfNotAvailableLocally); Observation getObservationEntity(Concept concept, String value); List<Concept> getNewConceptList(); static boolean isFormattedAsConcept(String peek); String getObservationUuid(); }
ObservationParserUtility { public Encounter getEncounterEntity(Date encounterDateTime,String formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid) { Encounter encounter = new Encounter(); encounter.setProvider(getDummyProvider(providerId)); encounter.setUuid(getEncounterUUID()); encounter.setLocation(getDummyLocation(locationId)); encounter.setEncounterType(getDummyEncounterType(formUuid)); encounter.setEncounterDatetime(encounterDateTime); encounter.setUserSystemId(userSystemId); encounter.setFormDataUuid(formDataUuid); encounter.setPatient(patient); return encounter; } ObservationParserUtility(MuzimaApplication muzimaApplication, boolean createObservationsForConceptsNotAvailableLocally); Encounter getEncounterEntity(Date encounterDateTime,String  formUuid,String providerId, int locationId, String userSystemId, Patient patient, String formDataUuid); Concept getConceptEntity(String rawConceptName, boolean isCoded, boolean createConceptIfNotAvailableLocally); Observation getObservationEntity(Concept concept, String value); List<Concept> getNewConceptList(); static boolean isFormattedAsConcept(String peek); String getObservationUuid();  }