Skip to content

Commit 5503890

Browse files
committed
Convert ProgressTestCase to pure JUnit 4
Unstable test on MacOS verification build which should hopefully get a bit more stable with "less" extra things being done by the tests.
1 parent 5c9af91 commit 5503890

File tree

3 files changed

+37
-42
lines changed

3 files changed

+37
-42
lines changed

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2017 IBM Corporation and others.
2+
* Copyright (c) 2009, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,14 @@
1515

1616
package org.eclipse.ui.tests.progress;
1717

18+
import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents;
19+
import static org.eclipse.ui.tests.harness.util.UITestCase.processEventsUntil;
20+
import static org.eclipse.ui.tests.harness.util.UITestCase.waitForJobs;
21+
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertFalse;
23+
import static org.junit.Assert.assertNotNull;
24+
import static org.junit.Assert.assertTrue;
25+
1826
import java.util.ArrayList;
1927
import java.util.List;
2028
import java.util.concurrent.TimeUnit;
@@ -38,14 +46,7 @@
3846
import org.eclipse.ui.progress.IProgressConstants2;
3947
import org.eclipse.ui.tests.TestPlugin;
4048
import org.junit.Test;
41-
import org.junit.runner.RunWith;
42-
import org.junit.runners.JUnit4;
43-
44-
/**
45-
* @since 3.6
46-
* @author Prakash G.R. ([email protected])
47-
*/
48-
@RunWith(JUnit4.class)
49+
4950
public class ProgressContantsTest extends ProgressTestCase {
5051

5152
/**
@@ -68,10 +69,6 @@ public boolean belongsTo(Object family) {
6869
}
6970
}
7071

71-
public ProgressContantsTest() {
72-
super(ProgressContantsTest.class.getSimpleName());
73-
}
74-
7572
@Test
7673
public void testCommandProperty() throws Exception {
7774

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressTestCase.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2019 IBM Corporation and others.
2+
* Copyright (c) 2009, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,9 @@
1414

1515
package org.eclipse.ui.tests.progress;
1616

17+
import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents;
18+
import static org.junit.Assert.assertNotNull;
19+
1720
import java.util.concurrent.TimeUnit;
1821
import java.util.concurrent.TimeoutException;
1922

@@ -25,33 +28,31 @@
2528
import org.eclipse.ui.IWorkbenchWindow;
2629
import org.eclipse.ui.internal.progress.FinishedJobs;
2730
import org.eclipse.ui.internal.progress.ProgressView;
31+
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
2832
import org.eclipse.ui.tests.harness.util.UITestCase;
33+
import org.junit.After;
34+
import org.junit.Before;
35+
import org.junit.Rule;
2936

30-
/**
31-
* @since 3.6
32-
*/
33-
public abstract class ProgressTestCase extends UITestCase {
37+
public abstract class ProgressTestCase {
3438

3539
protected ProgressView progressView;
3640
protected IWorkbenchWindow window;
3741

38-
public ProgressTestCase(String testName) {
39-
super(testName);
40-
}
42+
@Rule
43+
public final CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule();
4144

42-
@Override
43-
protected void doSetUp() throws Exception {
44-
super.doSetUp();
45-
window = openTestWindow("org.eclipse.ui.resourcePerspective");
45+
@Before
46+
public void doSetUp() throws Exception {
47+
window = UITestCase.openTestWindow("org.eclipse.ui.resourcePerspective");
4648

4749
// Remove progress info items before running the tests to prevent random
4850
// failings
4951
FinishedJobs.getInstance().clearAll();
5052
}
5153

52-
@Override
53-
protected void doTearDown() throws Exception {
54-
super.doTearDown();
54+
@After
55+
public void doTearDown() throws Exception {
5556
// Remove progress info items
5657
FinishedJobs.getInstance().clearAll();
5758
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressViewTests.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
package org.eclipse.ui.tests.progress;
1616

17+
import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents;
18+
import static org.eclipse.ui.tests.harness.util.UITestCase.processEventsUntil;
1719
import static org.junit.Assert.assertArrayEquals;
20+
import static org.junit.Assert.assertEquals;
21+
import static org.junit.Assert.assertFalse;
1822

1923
import java.util.ArrayList;
2024
import java.util.Arrays;
@@ -33,29 +37,22 @@
3337
import org.eclipse.ui.internal.progress.TaskInfo;
3438
import org.eclipse.ui.progress.IProgressConstants;
3539
import org.eclipse.ui.tests.TestPlugin;
40+
import org.junit.After;
41+
import org.junit.Before;
3642
import org.junit.Test;
37-
import org.junit.runner.RunWith;
38-
import org.junit.runners.JUnit4;
39-
40-
/**
41-
* @since 3.6
42-
* @author Prakash G.R.
43-
*/
44-
@RunWith(JUnit4.class)
45-
public class ProgressViewTests extends ProgressTestCase {
4643

47-
public ProgressViewTests() {
48-
super(ProgressViewTests.class.getSimpleName());
49-
}
44+
public class ProgressViewTests extends ProgressTestCase {
5045

5146
@Override
52-
protected void doSetUp() throws Exception {
47+
@Before
48+
public void doSetUp() throws Exception {
5349
super.doSetUp();
5450
FinishedJobs.getInstance().clearAll();
5551
}
5652

5753
@Override
58-
protected void doTearDown() throws Exception {
54+
@After
55+
public void doTearDown() throws Exception {
5956
FinishedJobs.getInstance().clearAll();
6057
super.doTearDown();
6158
}

0 commit comments

Comments
 (0)