Test default actions on Entity Page Maintenance Class
In addition, all defaults that are registered for a page maintenance must also be tested. This should be done through separate tester methods for each default, calling the FW support method public PageBody executeDefault(PageBody pageBody, String defaultValue)
:
public void testDefaultChg() {
PageBody input = new PageBody();
// TODO populate inputs for default
// e.g.
input.put("FK", "FK CODE");
PageBody output = executeDefault(input, "CHG");
// TODO compare the outputs
// e.g.
assertEquals("FK Description", output.get("FK_DESCR"));
}
Another example for testing the default on the field which in on the list.
public void testDefaultAlogrithm() {
ItemList itemList = new ItemList();
itemList.setName("MRRA");
List list = new ArrayList();
itemList.setList(list);
ListBody listBody = new ListBody();
listBody.put("MRR_ACTN_ALG_CD", "MRRCRESVCCC");
list.add(listBody);
PageBody input = new PageBody();
input.addList(itemList);
PageBody output = executeDefault(input, "AAD");
ItemList outList = output.getList("MRRA");
List outputList = outList.getList();
ListBody body = (ListBody) outList.getList().get(0);
assertEquals(body.get("MRRA_DESCR"),
"Create Service Customer Contact");
}
The input page body should be populated with the expected inputs for the default action, while the output should be compared against the expected output.