Skip to content

Commit d291a39

Browse files
committed
Replace obsolete usage of UITestCase#closeAllWindows()
Two tests unnecessarily employ functionality of a test rule to close all windows that have been opened throughout the test run. The windows to close are actually known to the tests and can directly be closed, such that the UITestCase does not need to expose the closing functionality of the test rule. This change adapts the tests accordingly and removes the unnecessary method from UITestCase.
1 parent 33ad00c commit d291a39

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/CloseTestWindowsRule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void removeWindowListener() {
7070
/**
7171
* Close all test windows.
7272
*/
73-
public void closeAllTestWindows() {
73+
private void closeAllTestWindows() {
7474
List<IWorkbenchWindow> testWindowsCopy = new ArrayList<>(testWindows);
7575
for (IWorkbenchWindow testWindow : testWindowsCopy) {
7676
testWindow.close();

tests/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/UITestCase.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@ protected void doTearDown() throws Exception {
154154
closeTestWindows.after();
155155
}
156156

157-
/**
158-
* Close all test windows.
159-
*/
160-
public void closeAllTestWindows() {
161-
closeTestWindows.closeAllTestWindows();
162-
}
163-
164157
/**
165158
* Set whether the window listener will manage opening and closing of created windows.
166159
*/

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public void testGetWorkbenchWindows() throws Throwable {
141141

142142
assertEquals(wins.length, oldTotal + num);
143143

144-
closeAllTestWindows();
144+
for (IWorkbenchWindow window : newWins) {
145+
window.close();
146+
}
145147
wins = getWorkbench().getWorkbenchWindows();
146148
assertEquals(wins.length, oldTotal);
147149
}

tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandCallbackTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public void testCallbackCleanup() throws Exception {
418418
try {
419419
assertEquals(2, cmd1Handler.callbacks);
420420
cmd1Handler.callbacks = 0;
421-
closeAllTestWindows();
421+
window.close();
422422
commandService.refreshElements(CMD1_ID, null);
423423
assertEquals(1, cmd1Handler.callbacks);
424424
} finally {

0 commit comments

Comments
 (0)