private static int getInputOkCancelSelection() { // first, we record that the SUT has issued a call // to JOptionPane.showConfirmDialog() JOptionPaneInputs.getInstance().addDialog(GUIAction.OK_CANCEL_SELECTION); // second, we check if an input is specified for that GUI stimulus if (JOptionPaneInputs.getInstance().containsOkCancelSelection()) { // return the specified input final int str = JOptionPaneInputs.getInstance().dequeueOkCancelSelection(); return str; } else { // return -1 by default if no input was specified return JOptionPane.CLOSED_OPTION; } }
private static String getStringInput() { // first, we record that the SUT issued a call to // JOptionPane.showInputDialog() JOptionPaneInputs.getInstance().addDialog(GUIAction.STRING_INPUT); // second, we check if an input is specified for that GUI stimulus if (JOptionPaneInputs.getInstance().containsStringInput()) { // return the specified input final String str = JOptionPaneInputs.getInstance().dequeueStringInput(); return str; } else { // return null by default if no input was specified return null; } }
private static int getInputYesNoSelection() { // first, we record that the SUT has issued a call // to JOptionPane.showConfirmDialog() JOptionPaneInputs.getInstance().addDialog(GUIAction.YES_NO_SELECTION); // second, we check if an input is specified for that GUI stimulus if (JOptionPaneInputs.getInstance().containsYesNoSelection()) { // return the specified input final int str = JOptionPaneInputs.getInstance().dequeueYesNoSelection(); return str; } else { // return -1 by default if no input was specified return JOptionPane.CLOSED_OPTION; } }
private static int getInputYesNoCancelSelection() { // first, we record that the SUT has issued a call // to JOptionPane.showConfirmDialog() JOptionPaneInputs.getInstance().addDialog(GUIAction.YES_NO_CANCEL_SELECTION); // second, we check if an input is specified for that GUI stimulus if (JOptionPaneInputs.getInstance().containsYesNoCancelSelection()) { // return the specified input final int str = JOptionPaneInputs.getInstance().dequeueYesNoCancelSelection(); return str; } else { // return -1 by default if no input was specified return JOptionPane.CLOSED_OPTION; } }
private static Object getOptionSelectionInt(final Object[] options) { // first, we record that the SUT has issued a call // to JOptionPane.showOptionDialog() JOptionPaneInputs.getInstance().addDialog(GUIAction.OPTION_SELECTION); // second, we check if an input is specified for that GUI stimulus if (JOptionPaneInputs.getInstance().containsOptionSelection()) { // return the specified input final int selection = JOptionPaneInputs.getInstance().dequeueOptionSelection(); if (selection < 0 || options == null) { // truncate lower return null; } else { if (selection >= options.length) { // truncate upper return options[options.length - 1]; } else { return options[selection]; } } } else { // return null by default if no input was specified return null; } }
JOptionPaneInputs.getInstance().addDialog(GUIAction.OPTION_SELECTION);