Skip to content

Commit 40e6a8e

Browse files
committed
[tests] log a TestException instead of RuntimeException
nightly logfile is flooded with intentional RuntimeException that are hard to distinguish from unintentional exceptions.
1 parent cc770ec commit 40e6a8e

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ClientEditor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.e4.ui.di.Focus;
1919
import org.eclipse.e4.ui.di.Persist;
2020
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
21+
import org.eclipse.e4.ui.tests.model.test.util.TestException;
2122

2223
public class ClientEditor {
2324

@@ -43,7 +44,7 @@ void delegateFocus() {
4344
void doSave() {
4445
saveCalled = true;
4546
if (throwException) {
46-
throw new RuntimeException();
47+
throw new TestException();
4748
}
4849

4950
dirtyable.setDirty(false);

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
4444
import org.eclipse.e4.ui.model.application.ui.basic.MWindowElement;
4545
import org.eclipse.e4.ui.services.IServiceConstants;
46+
import org.eclipse.e4.ui.tests.model.test.util.TestException;
4647
import org.eclipse.e4.ui.tests.workbench.TargetedView;
4748
import org.eclipse.e4.ui.workbench.modeling.EModelService;
4849
import org.eclipse.e4.ui.workbench.modeling.EPartService;
@@ -10103,27 +10104,27 @@ static class ExceptionListener implements IPartListener {
1010310104

1010410105
@Override
1010510106
public void partActivated(MPart part) {
10106-
throw new RuntimeException();
10107+
throw new TestException();
1010710108
}
1010810109

1010910110
@Override
1011010111
public void partBroughtToTop(MPart part) {
10111-
throw new RuntimeException();
10112+
throw new TestException();
1011210113
}
1011310114

1011410115
@Override
1011510116
public void partDeactivated(MPart part) {
10116-
throw new RuntimeException();
10117+
throw new TestException();
1011710118
}
1011810119

1011910120
@Override
1012010121
public void partHidden(MPart part) {
10121-
throw new RuntimeException();
10122+
throw new TestException();
1012210123
}
1012310124

1012410125
@Override
1012510126
public void partVisible(MPart part) {
10126-
throw new RuntimeException();
10127+
throw new TestException();
1012710128
}
1012810129

1012910130
}
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.e4.ui.tests.model.test.util;
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+
}

tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/SampleView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.eclipse.e4.core.contexts.IEclipseContext;
2323
import org.eclipse.e4.ui.di.PersistState;
2424
import org.eclipse.e4.ui.services.IServiceConstants;
25+
import org.eclipse.e4.ui.tests.model.test.util.TestException;
2526
import org.eclipse.jface.layout.GridLayoutFactory;
2627
import org.eclipse.jface.viewers.ITreeContentProvider;
2728
import org.eclipse.jface.viewers.LabelProvider;
@@ -57,7 +58,7 @@ public SampleView(Composite parent, final IEclipseContext outputContext,
5758

5859
parent.addDisposeListener(e -> {
5960
if (errorOnWidgetDisposal) {
60-
throw new RuntimeException();
61+
throw new TestException();
6162
}
6263
});
6364

@@ -154,7 +155,7 @@ void preDestroy() {
154155
nullParentContext = context.getParent() == null;
155156

156157
if (errorOnPreDestroy) {
157-
throw new RuntimeException();
158+
throw new TestException();
158159
}
159160
}
160161

0 commit comments

Comments
 (0)