Search in sources :

Example 36 with Encounter

use of org.openmrs.Encounter in project openmrs-core by openmrs.

the class ResultTest method earliest_shouldNotGetTheResultWithNullResultDateGivenOtherResults.

@Test
public void earliest_shouldNotGetTheResultWithNullResultDateGivenOtherResults() throws ParseException {
    Result parentResult = new Result();
    Result secondResult = new Result(null, "some value", new Encounter(123));
    Result firstResult = new Result(Context.getDateFormat().parse("12/08/2008"), "some other value", new Encounter(124));
    parentResult.add(firstResult);
    parentResult.add(secondResult);
    Assert.assertEquals("some other value", parentResult.earliest().toString());
}
Also used : Encounter(org.openmrs.Encounter) Test(org.junit.Test)

Example 37 with Encounter

use of org.openmrs.Encounter in project openmrs-core by openmrs.

the class ResultTest method earliest_shouldGetOneResultWithNullResultDatesForAllResults.

@Test
public void earliest_shouldGetOneResultWithNullResultDatesForAllResults() {
    Result parentResult = new Result();
    Result firstResult = new Result(null, "some value", new Encounter(123));
    Result secondResult = new Result(null, "some other value", new Encounter(124));
    parentResult.add(firstResult);
    parentResult.add(secondResult);
    Assert.assertEquals("some value", parentResult.earliest().toString());
}
Also used : Encounter(org.openmrs.Encounter) Test(org.junit.Test)

Example 38 with Encounter

use of org.openmrs.Encounter in project openmrs-core by openmrs.

the class ResultTest method get_shouldGetEmptyResultForIndexesOutOfRange.

@Test
public void get_shouldGetEmptyResultForIndexesOutOfRange() throws ParseException {
    Result parentResult = new Result();
    Result secondResult = new Result(null, "some value", new Encounter(123));
    Result firstResult = new Result(Context.getDateFormat().parse("12/08/2008"), "some other value", new Encounter(124));
    parentResult.add(firstResult);
    parentResult.add(secondResult);
    // 3 is greater than the number of entries in the parentResult
    Assert.assertEquals(new EmptyResult(), parentResult.get(3));
}
Also used : Encounter(org.openmrs.Encounter) Test(org.junit.Test)

Example 39 with Encounter

use of org.openmrs.Encounter in project openmrs-core by openmrs.

the class ResultTest method latest_shouldGetTheResultWithNullResultDate.

@Test
public void latest_shouldGetTheResultWithNullResultDate() throws ParseException {
    Result parentResult = new Result();
    Result firstResult = new Result(Context.getDateFormat().parse("15/08/2008"), "some value", new Encounter(123));
    Result secondResult = new Result(null, "some other value", new Encounter(124));
    parentResult.add(firstResult);
    parentResult.add(secondResult);
    Assert.assertEquals("some value", parentResult.latest().toString());
}
Also used : Encounter(org.openmrs.Encounter) Test(org.junit.Test)

Example 40 with Encounter

use of org.openmrs.Encounter in project openmrs-core by openmrs.

the class ResultTest method earliest_shouldGetTheResultGivenASingleResult.

@Test
public void earliest_shouldGetTheResultGivenASingleResult() throws ParseException {
    Result parentResult = new Result();
    Result secondResult = new Result(Context.getDateFormat().parse("15/08/2008"), "some other value", new Encounter(124));
    Result firstResult = new Result(Context.getDateFormat().parse("12/08/2008"), "some value", new Encounter(123));
    parentResult.add(firstResult);
    parentResult.add(secondResult);
    Assert.assertEquals("some value", parentResult.earliest().toString());
}
Also used : Encounter(org.openmrs.Encounter) Test(org.junit.Test)

Aggregations

Encounter (org.openmrs.Encounter)261 Test (org.junit.Test)204 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)153 Patient (org.openmrs.Patient)91 Date (java.util.Date)87 Order (org.openmrs.Order)46 Obs (org.openmrs.Obs)41 Visit (org.openmrs.Visit)40 Location (org.openmrs.Location)38 OrderUtilTest (org.openmrs.order.OrderUtilTest)38 DrugOrder (org.openmrs.DrugOrder)37 TestOrder (org.openmrs.TestOrder)34 EncounterType (org.openmrs.EncounterType)27 ArrayList (java.util.ArrayList)25 Concept (org.openmrs.Concept)25 BindException (org.springframework.validation.BindException)25 Calendar (java.util.Calendar)21 Errors (org.springframework.validation.Errors)21 User (org.openmrs.User)20 PihCoreContextSensitiveTest (org.openmrs.module.pihcore.PihCoreContextSensitiveTest)19