Skip to content

Commit 0073270

Browse files
committed
Remove setUp/tearDown overwrites in UI performance tests
Define separate @Before/@after methods instead.
1 parent 520e307 commit 0073270

File tree

5 files changed

+18
-42
lines changed

5 files changed

+18
-42
lines changed

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ViewerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.eclipse.swt.widgets.Shell;
2424
import org.eclipse.ui.tests.performance.BasicPerformanceTest;
2525
import org.eclipse.ui.tests.performance.UIPerformanceTestRule;
26+
import org.junit.After;
2627
import org.junit.ClassRule;
2728

2829
/**
@@ -83,9 +84,8 @@ public String getText(Object element) {
8384
};
8485
}
8586

86-
@Override
87-
protected void doTearDown() throws Exception {
88-
super.doTearDown();
87+
@After
88+
public final void closeBrowserShell() throws Exception {
8989
if(browserShell!= null){
9090
browserShell.close();
9191
browserShell = null;

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import org.eclipse.test.performance.PerformanceTestCaseJunit4;
2828
import org.eclipse.ui.PlatformUI;
2929
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
30-
import org.junit.After;
31-
import org.junit.Before;
3230
import org.junit.Rule;
3331
import org.junit.function.ThrowingRunnable;
3432
import org.osgi.framework.Bundle;
@@ -90,26 +88,6 @@ private boolean shouldLocallyTag() {
9088
return tagAsSummary;
9189
}
9290

93-
@Override
94-
@Before
95-
public void setUp() throws Exception {
96-
super.setUp();
97-
doSetUp();
98-
}
99-
100-
protected void doSetUp() throws Exception {
101-
}
102-
103-
@Override
104-
@After
105-
public void tearDown() throws Exception {
106-
doTearDown();
107-
super.tearDown();
108-
}
109-
110-
protected void doTearDown() throws Exception {
111-
}
112-
11391
protected IProject getProject() {
11492
if (testProject == null) {
11593
IWorkspace workspace = ResourcesPlugin.getWorkspace();

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/CommandsPerformanceTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import org.eclipse.jface.bindings.keys.KeyStroke;
3636
import org.eclipse.jface.bindings.keys.ParseException;
3737
import org.eclipse.jface.util.Util;
38+
import org.junit.After;
39+
import org.junit.Before;
3840
import org.junit.ClassRule;
3941
import org.junit.Test;
4042

@@ -176,10 +178,8 @@ private static final void createScheme(final BindingManager bindingManager,
176178
* @throws NotDefinedException
177179
* If something went wrong initializing the active scheme.
178180
*/
179-
@Override
180-
protected final void doSetUp() throws NotDefinedException, Exception {
181-
super.doSetUp();
182-
181+
@Before
182+
public final void setUpBindings() throws NotDefinedException, Exception {
183183
/*
184184
* The constants to use in creating the various objects. The platform
185185
* locale count must be greater than or equal to the number of deletion
@@ -346,12 +346,11 @@ protected final void doSetUp() throws NotDefinedException, Exception {
346346
bindingManager.setBindings(bindings);
347347
}
348348

349-
@Override
350-
protected final void doTearDown() throws Exception {
349+
@After
350+
public final void clearBindings() throws Exception {
351351
bindingManager = null;
352352
commandManager = null;
353353
contextManager = null;
354-
super.doTearDown();
355354
}
356355

357356
/**

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/LabelProviderTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import org.eclipse.swt.widgets.Display;
4747
import org.eclipse.swt.widgets.Shell;
4848
import org.eclipse.swt.widgets.Tree;
49+
import org.junit.After;
50+
import org.junit.Before;
4951
import org.junit.ClassRule;
5052
import org.junit.Test;
5153
import org.junit.runner.RunWith;
@@ -244,10 +246,8 @@ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
244246
return viewer;
245247
}
246248

247-
@Override
248-
protected void doSetUp() throws Exception {
249-
super.doSetUp();
250-
249+
@Before
250+
public final void prepareShellUp() throws Exception {
251251
Display display = Display.getCurrent();
252252
if (display == null)
253253
display = new Display();
@@ -266,9 +266,8 @@ protected void doSetUp() throws Exception {
266266
fShell.open();
267267
}
268268

269-
@Override
270-
protected void doTearDown() throws Exception {
271-
super.doTearDown();
269+
@After
270+
public final void closeShell() throws Exception {
272271
if (fShell != null) {
273272
fShell.close();
274273
fShell = null;

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ProgressReportingTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.ui.internal.IPreferenceConstants;
2929
import org.eclipse.ui.internal.WorkbenchPlugin;
3030
import org.eclipse.ui.tests.harness.util.PreferenceMementoRule;
31+
import org.junit.Before;
3132
import org.junit.ClassRule;
3233
import org.junit.Rule;
3334
import org.junit.Test;
@@ -82,10 +83,9 @@ public class ProgressReportingTest extends BasicPerformanceTest {
8283
private volatile boolean isDone;
8384
private Display display;
8485

85-
@Override
86-
protected void doSetUp() throws Exception {
86+
@Before
87+
public final void storeDisplay() throws Exception {
8788
this.display = Display.getCurrent();
88-
super.doSetUp();
8989
}
9090

9191
private void setRunInBackground(boolean newRunInBackgroundSetting) {

0 commit comments

Comments
 (0)