Skip to content

Commit

Permalink
[tests] log a TestException instead of RuntimeException
Browse files Browse the repository at this point in the history
nightly logfile is flooded with intentional RuntimeException that are
hard to distinguish from unintentional exceptions.
  • Loading branch information
EcljpseB0T authored and jukzi committed Oct 8, 2024
1 parent c3eba42 commit 7d29a59
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
import org.eclipse.e4.ui.tests.model.test.util.TestException;

public class ClientEditor {

Expand All @@ -43,7 +44,7 @@ void delegateFocus() {
void doSave() {
saveCalled = true;
if (throwException) {
throw new RuntimeException();
throw new TestException();
}

dirtyable.setDirty(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.model.application.ui.basic.MWindowElement;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.tests.model.test.util.TestException;
import org.eclipse.e4.ui.tests.workbench.TargetedView;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
Expand Down Expand Up @@ -10103,27 +10104,27 @@ static class ExceptionListener implements IPartListener {

@Override
public void partActivated(MPart part) {
throw new RuntimeException();
throw new TestException();
}

@Override
public void partBroughtToTop(MPart part) {
throw new RuntimeException();
throw new TestException();
}

@Override
public void partDeactivated(MPart part) {
throw new RuntimeException();
throw new TestException();
}

@Override
public void partHidden(MPart part) {
throw new RuntimeException();
throw new TestException();
}

@Override
public void partVisible(MPart part) {
throw new RuntimeException();
throw new TestException();
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2024 Joerg Kubitz and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Joerg Kubitz - initial API and implementation
******************************************************************************/

package org.eclipse.e4.ui.tests.model.test.util;

public class TestException extends RuntimeException {

private static final long serialVersionUID = 1L;

public TestException() {
super("Intentional TestException. Ignore me in the logfile.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.di.PersistState;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.tests.model.test.util.TestException;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
Expand Down Expand Up @@ -57,7 +58,7 @@ public SampleView(Composite parent, final IEclipseContext outputContext,

parent.addDisposeListener(e -> {
if (errorOnWidgetDisposal) {
throw new RuntimeException();
throw new TestException();
}
});

Expand Down Expand Up @@ -154,7 +155,7 @@ void preDestroy() {
nullParentContext = context.getParent() == null;

if (errorOnPreDestroy) {
throw new RuntimeException();
throw new TestException();
}
}

Expand Down

0 comments on commit 7d29a59

Please sign in to comment.