Source:
public void shouldCreatePatientWithGivenParameters() { Person person = createTestPerson(); Concept causeOfDeath = createTestConcept(); person.setDead(true); person.setCauseOfDeath(causeOfDeath); Location location = new Location(); location.setName("testLocation"); Identifier identifier = new Identifier("1000", new IdentifierType("CommCare CaseID")); Patient patient = new Patient(Collections.singletonList(identifier), person, "500", location); Map<String, String> identifiersMap = new HashMap<>(); identifiersMap.put("CommCare CaseID", "1000"); doReturn(causeOfDeath).when(conceptService).getConceptByUuid(causeOfDeath.getUuid()); doReturn(Collections.singletonList(location)).when(locationService).getLocations(location.getName()); openMRSActionProxyService.createPatient(person.getPreferredName().getGivenName(), person.getPreferredName().getMiddleName(), person.getPreferredName().getFamilyName(), person.getPreferredAddress().getAddress1(), person.getPreferredAddress().getAddress2(), person.getPreferredAddress().getAddress3(), person.getPreferredAddress().getAddress4(), person.getPreferredAddress().getAddress5(), person.getPreferredAddress().getAddress6(), person.getPreferredAddress().getCityVillage(), person.getPreferredAddress().getStateProvince(), person.getPreferredAddress().getCountry(), person.getPreferredAddress().getPostalCode(), person.getPreferredAddress().getCountyDistrict(), person.getPreferredAddress().getLatitude(), person.getPreferredAddress().getLongitude(), new DateTime(person.getPreferredAddress().getStartDate()), new DateTime(person.getPreferredAddress().getEndDate()), new DateTime(person.getBirthdate()), person.getBirthdateEstimated(), person.getGender(), person.getDead(), causeOfDeath.getUuid(), patient.getMotechId(), location.getName(), identifiersMap); verify(patientService).createPatient(patientCaptor.capture()); assertEquals(patient, patientCaptor.getValue()); }

Target:
public void shouldCreatePatientWithGivenParameters() { Person person = createTestPerson(); Concept causeOfDeath = createTestConcept(); person.setDead(true); person.setCauseOfDeath(causeOfDeath); Location location = new Location(); location.setName("testLocation"); Identifier identifier = new Identifier("1000", new IdentifierType("CommCare CaseID")); Patient patient = new Patient(Collections.singletonList(identifier), person, "500", location); Map<String, String> identifiersMap = new HashMap<>(); identifiersMap.put("CommCare CaseID", "1000"); doReturn(causeOfDeath).when(conceptService).getConceptByUuid(eq(null), eq(causeOfDeath.getUuid())); doReturn(Collections.singletonList(location)).when(locationService).getLocations(eq(null), eq(location.getName())); Person.Address personAddress = person.getPreferredAddress(); openMRSActionProxyService.createPatient(person.getPreferredName().getGivenName(), person.getPreferredName().getMiddleName(), person.getPreferredName().getFamilyName(), personAddress.getAddress1(), personAddress.getAddress2(), personAddress.getAddress3(), personAddress.getAddress4(), personAddress.getAddress5(), personAddress.getAddress6(), personAddress.getCityVillage(), personAddress.getStateProvince(), personAddress.getCountry(), personAddress.getPostalCode(), personAddress.getCountyDistrict(), personAddress.getLatitude(), personAddress.getLongitude(), new DateTime(personAddress.getStartDate()), new DateTime(personAddress.getEndDate()), new DateTime(person.getBirthdate()), person.getBirthdateEstimated(), person.getGender(), person.getDead(), causeOfDeath.getUuid(), patient.getMotechId(), location.getName(), identifiersMap); verify(patientService).createPatient(eq(null), patientCaptor.capture()); assertEquals(patient, patientCaptor.getValue()); }