Skip to content

Commit 00f5460

Browse files
committed
Wait for auto-refresh before copying test file in CopyMoveElementsTests
To avoid delta notifications sent asynchronously from RefreshJob, this change adjusts intermittently failing tests in CopyMoveElementsTests to wait on the auto-refresh before copying test files. See: #2552
1 parent 901177a commit 00f5460

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ public void testCopyFieldsMultiStatus() throws CoreException {
403403
}
404404
dests[1] = fieldsSource[0]; //invalid destination
405405
dests[2]= fieldsSource[0];
406+
waitForAutoRefresh();
406407
DeltaListener listener = new DeltaListener();
407408
try {
408409
startDeltas(listener);

org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public void copyNegative(IJavaElement[] elements, IJavaElement[] destinations, I
5959
* encountered are thrown.
6060
*/
6161
public IJavaElement copyPositive(IJavaElement element, IJavaElement container, IJavaElement sibling, String rename, boolean force) throws CoreException {
62+
// make sure auto-refresh is not interfering with the test, see e.g.: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2552
63+
waitForAutoRefresh();
6264
// if forcing, ensure that a name collision exists
6365
if (force) {
6466
IJavaElement collision = generateHandle(element, rename, container);

0 commit comments

Comments
 (0)