Skip to content

Package: DatabindingClassRunner

DatabindingClassRunner

nameinstructionbranchcomplexitylinemethod
DatabindingClassRunner(Class)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
run(RunNotifier)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. 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: * Johannes Faltermeier
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.view.test.common.swt.spi;
16:
17: import org.eclipse.core.databinding.observable.Realm;
18: import org.eclipse.jface.databinding.swt.DisplayRealm;
19: import org.eclipse.swt.widgets.Display;
20: import org.junit.runner.notification.RunNotifier;
21: import org.junit.runners.BlockJUnit4ClassRunner;
22: import org.junit.runners.model.InitializationError;
23:
24: /**
25: * Custom junit class runner to setup Realm.
26: *
27: * @author jfaltermeier
28: *
29: */
30: public class DatabindingClassRunner extends BlockJUnit4ClassRunner {
31:
32:         /**
33:          * Creates a DatabindingClassRunner providing a {@link Realm} to run {@code klass}.
34:          *
35:          * @param klass the test class to be executed
36:          * @throws InitializationError if the test class is malformed.
37:          */
38:         public DatabindingClassRunner(Class<?> klass) throws InitializationError {
39:                 super(klass);
40:         }
41:
42:         @Override
43:         public void run(final RunNotifier notifier) {
44:                 final Display display = Display.getDefault();
45:                 Realm.runWithDefault(DisplayRealm.getRealm(display), new Runnable() {
46:                         @Override
47:                         public void run() {
48:                                 DatabindingClassRunner.super.run(notifier);
49:                         }
50:                 });
51:         }
52: }