    @Test
    public void testExecuteSuccessListNoMailResource() {

        createMailResource();

        parameters = new ParameterMap();
        org.glassfish.resources.mail.admin.cli.ListMailResources listCommand = habitat.getService(org.glassfish.resources.mail.admin.cli.ListMailResources.class);
        cr.getCommandInvocation("list-mail-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);

        List<ActionReport.MessagePart> list = context.getActionReport().getTopMessagePart().getChildren();
        assertEquals(origNum + 1, list.size());
        origNum = origNum + 1; //as we newly created a resource after test "setup".

        deleteMailResource();
        parameters = new ParameterMap();
        listCommand = habitat.getService(org.glassfish.resources.mail.admin.cli.ListMailResources.class);
        context = new AdminCommandContextImpl(
                LogDomains.getLogger(ListMailResourcesTest.class, LogDomains.ADMIN_LOGGER),
                new PropsFileActionReporter());
        cr.getCommandInvocation("list-mail-resources", context.getActionReport(), adminSubject()).parameters(parameters).execute(listCommand);
        list = context.getActionReport().getTopMessagePart().getChildren();
        if ((origNum - 1) == 0) {
            //Nothing to list.
        } else {
            assertEquals(origNum - 1, list.size());
        }
        List<String> listStr = new ArrayList<String>();
        for (MessagePart mp : list) {
            listStr.add(mp.getMessage());
        }
        assertFalse(listStr.contains("mailresource"));
        assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());
    }