~ubuntu-branches/ubuntu/saucy/mockito/saucy

« back to all changes in this revision

Viewing changes to org/mockito/Mock.java

  • Committer: Package Import Robot
  • Author(s): David Paleino
  • Date: 2012-03-19 23:53:45 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120319235345-ommdb05d5kmn4q9g
Tags: 1.9.0+ds1-1
* New upstream version
* Updated debian/watch
* Fix FTBFS with hamcrest new interfaces (Closes: #661877)
* Updated debian/copyright
* Bump Standards-Version to 3.9.3, no changes needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2007 Mockito contributors
3
 
 * This program is made available under the terms of the MIT License.
4
 
 */
 
1
/*
 
2
 * Copyright (c) 2007 Mockito contributors
 
3
 * This program is made available under the terms of the MIT License.
 
4
 */
5
5
package org.mockito;
6
6
 
7
 
import static java.lang.annotation.ElementType.*;
 
7
import org.mockito.runners.MockitoJUnitRunner;
8
8
 
9
9
import java.lang.annotation.Documented;
10
10
import java.lang.annotation.Retention;
11
11
import java.lang.annotation.RetentionPolicy;
12
12
import java.lang.annotation.Target;
13
13
 
14
 
import org.mockito.runners.MockitoJUnitRunner;
 
14
import static java.lang.annotation.ElementType.FIELD;
15
15
 
16
16
/**
17
17
 * <ul>
21
21
 * <li>Makes the verification error easier to read because the <b>field name</b> is used to identify the mock.</li>
22
22
 * </ul>
23
23
 *
24
 
 * <pre>
 
24
 * <pre class="code"><code class="java">
25
25
 *   public class ArticleManagerTest extends SampleBaseTestCase {
26
26
 *
27
27
 *       &#064;Mock private ArticleCalculator calculator;
28
28
 *       &#064;Mock(name = "dbMock") private ArticleDatabase database;
29
29
 *       &#064;Mock(answer = RETURNS_MOCKS) private UserProvider userProvider;
 
30
 *       &#064;Mock(extraInterfaces = {Queue.class, Observer.class}) private  articleMonitor;
30
31
 *
31
32
 *       private ArticleManager manager;
32
33
 *
33
34
 *       &#064;Before public void setup() {
34
 
 *           manager = new ArticleManager(userProvider, database, calculator);
 
35
 *           manager = new ArticleManager(userProvider, database, calculator, articleMonitor);
35
36
 *       }
36
37
 *   }
37
38
 *
41
42
 *           MockitoAnnotations.initMocks(this);
42
43
 *       }
43
44
 *   }
44
 
 * </pre>
 
45
 * </code></pre>
45
46
 *
46
47
 * <b><code>MockitoAnnotations.initMocks(this)</code></b> method has to called to initialize annotated mocks.
47
48
 * <p>