matthiasblaesing commented on code in PR #9200:
URL: https://github.com/apache/netbeans/pull/9200#discussion_r2809602197
##########
java/java.editor/test/unit/src/org/netbeans/modules/java/editor/imports/ClipboardHandlerTest.java:
##########
@@ -128,6 +236,36 @@ private void copyAndPaste(String from, final String to,
String golden, String so
assertTrue(pastePos >= 0);
+ FileObject src = doCopyAndPaste(from, sourceLevel);
+ final JEditorPane[] target = new JEditorPane[1];
+ final Exception[] fromAWT = new Exception[1];
+
+ target[0] = paneFor(src, "test/Target.java",
to.replaceAll(Pattern.quote("^"), ""), sourceLevel);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override public void run() {
+ try {
+ target[0].setCaretPosition(pastePos);
+
+ target[0].paste();
+ } catch (Exception ex) {
+ fromAWT[0] = ex;
+ }
+ }
+ });
+
+ if (fromAWT[0] != null) throw fromAWT[0];
+
+ final String[] actual = new String[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override public void run() {
+ actual[0] = target[0].getText();
+ }
+ });
+ assertEquals(golden, actual[0]);
+ }
+
+ private FileObject doCopyAndPaste(String from, String sourceLevel) throws
Exception {
Review Comment:
```suggestion
private FileObject doCopy(String from, String sourceLevel) throws
Exception {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists