Skip to content

Commit d5815f3

Browse files
committed
[ui.tests] log a TestException instead of RuntimeException
Nightly org.eclipse.ui.tests.UiTestSuite.txt contains intentional RuntimeException that are hard to distinguish from unintentional exceptions.
1 parent b945db1 commit d5815f3

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public String getFactoryId() {
7272
public void saveState(IMemento memento) {
7373
if (shouldSaveFail) {
7474
saveAttemptedWhileShouldFail = true;
75-
throw new RuntimeException();
75+
throw new TestException();
7676
}
7777

7878
}
@@ -83,7 +83,7 @@ public void saveState(IMemento memento) {
8383
public IAdaptable createElement(IMemento memento) {
8484
if (shouldFailOnCreateElement) {
8585
elementCreationAttemptedWhileShouldFail = true;
86-
throw new RuntimeException();
86+
throw new TestException();
8787
}
8888
return new BadElementInstance();
8989
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public void testListenerSafety() throws Throwable {
419419
final boolean[] result = new boolean[1];
420420
// add a bogus listener that dies unexpectedly
421421
IPropertyChangeListener badListener = event -> {
422-
throw new RuntimeException();
422+
throw new TestException();
423423

424424
};
425425
IPropertyChangeListener goodListener = event -> result[0] = true;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Joerg Kubitz and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* Joerg Kubitz - initial API and implementation
13+
******************************************************************************/
14+
15+
package org.eclipse.ui.tests.api;
16+
17+
public class TestException extends RuntimeException {
18+
19+
private static final long serialVersionUID = 1L;
20+
21+
public TestException() {
22+
super("Intentional TestException. Ignore me in the logfile.");
23+
}
24+
25+
}

0 commit comments

Comments
 (0)