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());
}
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());
}
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));
}
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());
}
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());
}
Aggregations