JAboutDialog extends AbstractSimpleDialog { private void copyToClipboard() { StringSelection sel = new StringSelection(textArea.getText()); Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); clip.setContents(sel, sel); } JAboutDialog();  JAboutDialog(String title);  JAboutDialog(String title, String applicationInfo); @Override JPanel createControlPanel(); @Override void onOK();  }
@Test public void copyToClipboard() throws Exception { createAndShow(true); JButtonFixture button = windowFixture.button(new GenericTypeMatcher<JButton>(JButton.class) { @Override protected boolean isMatching(JButton component) { return "Copy to clipboard".equals(component.getText()); } }); assertNotNull(button); windowFixture.list().clickItem(JAboutDialog.Category.ALL.toString()); windowFixture.robot.waitForIdle(); button.click(); windowFixture.robot.waitForIdle(); Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); String clipText = (String) clip.getData(DataFlavor.stringFlavor); String expected = getDialogTextArea().text(); assertEquals(expected, clipText); }