Test default actions on 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(Maintenance.STRUCTURE.FK, "FK CODE");
PageBody output = executeDefault(input, Maintenance.DEFAULTS.CHG);
// TODO compare the outputs
// e.g.
assertEquals("FK Description",
output.get(Maintenance.STRUCTURE.FK_DESCR));
}
Here is an example to test the default on a field under a list.
public void testDefaultAlogrithm() {
PageBody input = new PageBody();
ItemList itemList = input.newItemList
(Maintenance.STRUCTURE.list_MRRA.name);
ListBody listBody = itemList.newListBody();
listBody.put(Maintenance.STRUCTURE.list_MRRA.MRR_ACTN_ALG_CD,
"MRRCRESVCCC");
PageBody output = executeDefault(input, Maintenance.DEFAULTS.AAD);
ItemList outList = output.getList
(Maintenance.STRUCTURE.list_MRRA.name);
ListBody body = (ListBody) outList.getList().get(0);
assertEquals(body.get(Maintenance.STRUCTURE.list_MRRA.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.