results.assertEncounterCreated();
encounter = results.getEncounterCreated();
List<Order> orders = getOrderedOrders(encounter);
Drug drug = Context.getConceptService().getDrug(2);
assertThat(orders, contains(allOf(hasProperty("drug", is(drug)), hasProperty("dose", is(1.0)),
hasProperty("dateActivated", is(ymdToDate(dateAsString(date))))),
allOf(hasProperty("drug", is(drug)), hasProperty("action", is(Order.Action.DISCONTINUE)), hasProperty("dateActivated", is(ymdToDate(dateAsString(discontinueDate)))))));
}
@Override
public Encounter getEncounterToEdit() {
return encounter;
}
@Override
public void testEditFormHtml(String html) {
System.out.println(html);
}
@Override
public void setupEditRequest(MockHttpServletRequest request, Map<String, String> widgets) {
//drug
request.setParameter("w7", "2");
//start date
request.setParameter("w9", dateAsString(date));
//dosing type
request.setParameter("w17", "org.openmrs.SimpleDosingInstructions");
//dose
request.setParameter("w11", "2"); //changes to dose should not be persisted
request.setParameter("w18", "51");
//care setting
request.setParameter("w26", "2");
//route
request.setParameter("w25", "22");
//frequency
request.setParameter("w13", "1");
//discontinue date
request.setParameter("w15", dateAsString(newDiscontinueDate));
}
public void testEditedResults(SubmissionResults results) {
Encounter editedEncounter = results.getEncounterCreated();
List<Order> orders = getOrderedOrders(editedEncounter);
Drug drug = Context.getConceptService().getDrug(2);
assertThat(orders, contains(
allOf(hasProperty("drug", is(drug)), hasProperty("dose", is(1.0)),
hasProperty("dateActivated", is(ymdToDate(dateAsString(date))))),
allOf(hasProperty("drug", is(drug)), hasProperty("voided", is(true)),
hasProperty("action", is(Order.Action.DISCONTINUE)), hasProperty("dateActivated", is(ymdToDate(dateAsString(discontinueDate))))),