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; } }