Skip to content

Package: EMFMockingRunner

EMFMockingRunner

nameinstructionbranchcomplexitylinemethod
EMFMockingRunner(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%
createTest()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2019 Christian W. Damus 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: * Christian W. Damus - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.test.common.spi;
15:
16: import org.junit.runners.BlockJUnit4ClassRunner;
17: import org.junit.runners.model.InitializationError;
18: import org.mockito.MockitoAnnotations;
19:
20: /**
21: * A JUnit runner for injection of Mockito mocks with {@link EMock @EMock} fields.
22: *
23: * @since 1.22
24: */
25: public class EMFMockingRunner extends BlockJUnit4ClassRunner {
26:
27:         /**
28:          * Initializes me.
29:          *
30:          * @param classs the test class to initialize
31:          * @throws InitializationError on any failure to initialize the test class
32:          */
33:         public EMFMockingRunner(Class<?> classs) throws InitializationError {
34:                 super(classs);
35:         }
36:
37:         @Override
38:         protected Object createTest() throws Exception {
39:                 final Object result = super.createTest();
40:
41:                 MockitoAnnotations.initMocks(result);
42:
43:                 EMFMocking.initEMocks(result);
44:
45:                 return result;
46:         }
47:
48: }