Maintenances

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.) Then, you should retry the default with warnings disabled, and ensure that you get the behavior otherwise expected.