If you mean, how do I simulate the ctrl + V and ctrl + C events in a JUnit test for a Swing application, I would recommend looking at FEST . Using FEST, you can simulate mouse clicks or keystrokes. To simulate ctrl + V , you would do:
// import static java.awt.event.KeyEvent.*; dialog.list("employees").pressKey(VK_CONTROL) .pressAndReleaseKey(VK_V) .releaseKey(VK_CONTROL);
etc. For more information on modeling user input, see Wiki Simulating Keyboard Input .
source share