EasyMockRunner, EasyMockRule or EasyMockSupport#injectMocks(Object)
will inject a mock to it.
Doing
@Mock private MyClass mock;
is strictly identical to doing
private MyClass mock = createMock(MyClass.class);
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: name of the field to inject toName of the test subject field to which this mock will be assigned. |
| public String | Returns: name of the mock to be created. By default, it is the "EasyMock for field TypeName.fieldName
|
| public MockType | |
| public MockType |
| fieldName | back to summary |
|---|---|
| public String fieldName() Name of the test subject field to which this mock will be assigned. Use to disambiguate the case where a mock may be assigned to multiple fields of the same type. When set, this mock will be assigned to the given field name in any test subject with a matching field name. If not set, injection is to all type-compatible fields in all test subjects. A given field name may only be used once, and there must be a matching field in at least one test subject.
| |
| name | back to summary |
|---|---|
public String name()
| |
| type | back to summary |
|---|---|
public MockType type()
| |
| value | back to summary |
|---|---|
| public MockType value() | |