diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java index 53444f47202..b2dfd7b485d 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -15,6 +15,14 @@ package org.eclipse.ui.tests.progress; +import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents; +import static org.eclipse.ui.tests.harness.util.UITestCase.processEventsUntil; +import static org.eclipse.ui.tests.harness.util.UITestCase.waitForJobs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; @@ -38,14 +46,7 @@ import org.eclipse.ui.progress.IProgressConstants2; import org.eclipse.ui.tests.TestPlugin; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * @since 3.6 - * @author Prakash G.R. (grprakash@in.ibm.com) - */ -@RunWith(JUnit4.class) + public class ProgressContantsTest extends ProgressTestCase { /** @@ -68,10 +69,6 @@ public boolean belongsTo(Object family) { } } - public ProgressContantsTest() { - super(ProgressContantsTest.class.getSimpleName()); - } - @Test public void testCommandProperty() throws Exception { diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressTestCase.java index 7ddda9cbe89..925efee4939 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressTestCase.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2019 IBM Corporation and others. + * Copyright (c) 2009, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,9 @@ package org.eclipse.ui.tests.progress; +import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents; +import static org.junit.Assert.assertNotNull; + import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -25,33 +28,31 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.internal.progress.FinishedJobs; import org.eclipse.ui.internal.progress.ProgressView; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; import org.eclipse.ui.tests.harness.util.UITestCase; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; -/** - * @since 3.6 - */ -public abstract class ProgressTestCase extends UITestCase { +public abstract class ProgressTestCase { protected ProgressView progressView; protected IWorkbenchWindow window; - public ProgressTestCase(String testName) { - super(testName); - } + @Rule + public final CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - @Override - protected void doSetUp() throws Exception { - super.doSetUp(); - window = openTestWindow("org.eclipse.ui.resourcePerspective"); + @Before + public void doSetUp() throws Exception { + window = UITestCase.openTestWindow("org.eclipse.ui.resourcePerspective"); // Remove progress info items before running the tests to prevent random // failings FinishedJobs.getInstance().clearAll(); } - @Override - protected void doTearDown() throws Exception { - super.doTearDown(); + @After + public void doTearDown() throws Exception { // Remove progress info items FinishedJobs.getInstance().clearAll(); } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressViewTests.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressViewTests.java index cd21a3e70f8..78128f0e126 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressViewTests.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressViewTests.java @@ -14,7 +14,11 @@ package org.eclipse.ui.tests.progress; +import static org.eclipse.ui.tests.harness.util.UITestCase.processEvents; +import static org.eclipse.ui.tests.harness.util.UITestCase.processEventsUntil; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import java.util.ArrayList; import java.util.Arrays; @@ -33,29 +37,22 @@ import org.eclipse.ui.internal.progress.TaskInfo; import org.eclipse.ui.progress.IProgressConstants; import org.eclipse.ui.tests.TestPlugin; +import org.junit.After; +import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * @since 3.6 - * @author Prakash G.R. - */ -@RunWith(JUnit4.class) -public class ProgressViewTests extends ProgressTestCase { - public ProgressViewTests() { - super(ProgressViewTests.class.getSimpleName()); - } +public class ProgressViewTests extends ProgressTestCase { @Override - protected void doSetUp() throws Exception { + @Before + public void doSetUp() throws Exception { super.doSetUp(); FinishedJobs.getInstance().clearAll(); } @Override - protected void doTearDown() throws Exception { + @After + public void doTearDown() throws Exception { FinishedJobs.getInstance().clearAll(); super.doTearDown(); }