File: MockitoJUnit44Runner.java

package info (click to toggle)
mockito 2.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 5,644 kB
  • sloc: java: 44,519; xml: 48; makefile: 4
file content (56 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */

package org.mockito.runners;

import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.lang.reflect.InvocationTargetException;

/**
 * <b>Deprecated: Simply use {@link MockitoJUnitRunner}</b>
 * <p>
 * Compatible only with <b>JUnit 4.4</b>, this runner adds following behavior:
 * <ul>
 *   <li>
 *      Initializes mocks annotated with {@link Mock},
 *      so that explicit usage of {@link MockitoAnnotations#initMocks(Object)} is not necessary. 
 *      Mocks are initialized before each test method.
 *   <li>
 *      validates framework usage after each test method. See javadoc for {@link Mockito#validateMockitoUsage()}.
 * </ul>
 * 
 * Runner is completely optional - there are other ways you can get &#064;Mock working, for example by writing a base class.
 * Explicitly validating framework usage is also optional because it is triggered automatically by Mockito every time you use the framework.
 * See javadoc for {@link Mockito#validateMockitoUsage()}.
 * <p>
 * Read more about &#064;Mock annotation in javadoc for {@link MockitoAnnotations}
 * <p>
 * Example:
 * <pre class="code"><code class="java">
 * &#064;RunWith(MockitoJUnitRunner.class)
 * public class ExampleTest {
 * 
 *     &#064;Mock
 *     private List list;
 * 
 *     &#064;Test
 *     public void shouldDoSomething() {
 *         list.add(100);
 *     }
 * }
 * <p>
 * 
 * </code></pre>
 */
@Deprecated
public class MockitoJUnit44Runner extends MockitoJUnitRunner {

    public MockitoJUnit44Runner(Class<?> klass) throws InvocationTargetException {
        super(klass);
    }
}