Maintenance Classes
Here is complete valid example of verifying that a maintenance default action issues a proper warning.
public void testDefaultDEFAULT_FOR_ZONE_HNDL() {
PageBody input = new PageBody();
input.put(ContentZoneMaintenance.STRUCTURE.ZONE_CD, "CI_AFH");
// test the default and expect to get a warning
try {
executeDefault(input, "ZH");
fail("Should have a warning");
} catch (ApplicationWarning e) {
verifyWarningContains(e,
MessageRepository.deleteZoneParametersWarning());
}
disableWarnings();
// test the default and do not expect to get a warning or error
PageBody output = executeDefault(input, "ZH");
assertEquals(Boolean.TRUE, output.get("DELETE_SW"));
}
Note: Warnings are enabled by default. To catch an application warning, you should put
the normal try/catch block around the default execution. Once inside the catch block,
you should verify that the warnings are the expected ones. This verification is to be
done considering only the message category and number (if there are parameters to the
message construction, their values are irrelevant). You should then retry the default
with the warnings disabled.