Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: df3b6417ce7a
Choose a base ref
...
head repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ed03fefbfb8a
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jul 16, 2013

  1. Copy the full SHA
    af9f8a8 View commit details

Commits on Jul 18, 2013

  1. Merge pull request #363 from jsala1990/master

    TRUNK-3257 Added junit test for making voided searches impossible
    dkayiwa committed Jul 18, 2013
    Copy the full SHA
    ed03fef View commit details
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ private Criterion prepareNameCriterion(String name) {
name = name.replace(", ", " ");
String[] names = name.split(" ");

// TODO add junit test for searching on voided patient names

if (names.length > 0) {
String nameSoFar = names[0];
for (int i = 0; i < names.length; i++) {
Original file line number Diff line number Diff line change
@@ -13,14 +13,16 @@
*/
package org.openmrs.api.db.hibernate;

import java.util.List;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.Patient;
import org.openmrs.PatientIdentifierType;
import org.openmrs.test.BaseContextSensitiveTest;

import java.util.Collections;
import java.util.List;

public class HibernatePatientDAOTest extends BaseContextSensitiveTest {

private HibernatePatientDAO dao = null;
@@ -280,4 +282,18 @@ public void getPatientIdentifierTypes_shouldReturnNonRetiredPatientIdentifierTyp
Assert.assertArrayEquals(new Object[] { openMRSIdNumber, oldIdNumber, socialSecNumber }, patientIdentifierTypes
.toArray());
}

@Test
public void searchByPatientName_shouldNotMatchVoidedPersonNames(){
List<PatientIdentifierType> identifierTypes = Collections.emptyList();
List<Patient> patients = dao.getPatients("Hornblower3", null, identifierTypes, false, 0, 11, false);
Assert.assertEquals(1, patients.size());

Patient patient = patients.get(0);
patient.setVoided(true);
dao.savePatient(patient);

patients = dao.getPatients("Hornblower3", null, identifierTypes, false, 0, 11, false);
Assert.assertEquals(0, patients.size());
}
}