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: By default, warnings are enabled, thus nothing special need be done. But you should put the normal try/catch block around the default execution, and catch an application warning. Once inside the catch block, you should verify that the warning(s) is/are valid expected ones. (This comparison is only done via the message category and message number. Thus, if there are parameters to the message construction, it matters not their values, since it may be difficult to get the values.) You should then retry the default with warnings disabled.