Source:
<code>public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); Visit visit = new Visit(); visit.setUuid("40"); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap<>(); observations.put("testConceptName", "testObservationValueName"); List<Observation> obsList = createObservationList(); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, visit, Collections.singletonList(provider.getPerson()), obsList); doReturn(patient).when(patientService).getPatientByUuid(eq(CONFIG_NAME), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(CONFIG_NAME), eq(provider.getUuid())); doReturn(visit).when(visitService).getVisitByUuid(eq(CONFIG_NAME), eq(visit.getUuid())); doReturn(Collections.singletonList(location)) .when(locationService).getLocations(eq(CONFIG_NAME), eq(location.getName())); <START> openMRSActionProxyService.createEncounter(CONFIG_NAME, new DateTime(encounter.getEncounterDatetime()), <END> encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), visit.getUuid(), observations); verify(encounterService).createEncounter(eq(CONFIG_NAME), encounterCaptor.capture()); assertEquals(encounter, encounterCaptor.getValue()); }</code><technical_language>do change this test, check if proper encounter is returned createEncounter service</technical_language>

Target:
public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); Visit visit = new Visit(); visit.setUuid("40"); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap<>(); observations.put("testConceptName", "testObservationValueName"); List<Observation> obsList = createObservationList(); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, visit, Collections.singletonList(provider.getPerson()), obsList); doReturn(patient).when(patientService).getPatientByUuid(eq(CONFIG_NAME), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(CONFIG_NAME), eq(provider.getUuid())); doReturn(visit).when(visitService).getVisitByUuid(eq(CONFIG_NAME), eq(visit.getUuid())); doReturn(encounter).when(encounterService).createEncounter(eq(CONFIG_NAME), eq(encounter)); doReturn(Collections.singletonList(location)) .when(locationService).getLocations(eq(CONFIG_NAME), eq(location.getName())); Encounter encounterCreated = openMRSActionProxyService.createEncounter(CONFIG_NAME, new DateTime(encounter.getEncounterDatetime()), encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), visit.getUuid(), observations); assertEquals(encounter, encounterCreated); }