/** * Executes the given command. * * <ul> * <li>Checks first if the command is enabled. * <li>Checks if the executed command has the expected execution result state. * <li>In case of an unexpected outcome it reports all messages found in the conversation. * </ul> * * @param msg the assert message to display if the operation fails. * @param cmd the command to execute. * @param expectedState the expected execution result state. */ public static void doIt(String msg, PmCommand cmd, CommandState expectedState) { assertEnabled(cmd); CommandState execState = cmd.doIt().getCommandState(); if (execState != expectedState) { String msgPfx = StringUtils.isEmpty(msg) ? cmd.getPmRelativeName() : msg; Assert.assertEquals( msgPfx + subTreeMessagesToString(" Messages: ", cmd.getPmConversation(), Severity.WARN), expectedState, execState); } }
/** * Executes the given command. * * <ul> * <li>Checks first if the command is enabled. * <li>Checks if the executed command has the expected execution result state. * <li>In case of an unexpected outcome it reports all messages found in the conversation. * </ul> * * @param cmd the command to execute. * @param expectedState the expected execution result state. */ public static void doIt(PmCommand cmd, CommandState expectedState) { doIt(cmd.getPmRelativeName(), cmd, expectedState); }
/** * Executes the given command. * * <ul> * <li>Checks first if the command is enabled. * <li>Checks if the executed command has the state {@link * org.pm4j.core.pm.PmCommand.CommandState#EXECUTED}. * <li>In case of an unexpected outcome it reports all messages found in the conversation. * </ul> * * @param cmd the command to execute. */ public static void doIt(PmCommand cmd) { doIt(cmd.getPmRelativeName(), cmd, CommandState.EXECUTED); }