Reputation: 23
Consider a test as below -
public class TestSomething
{
@Mocked static SomeObject mocked;
@Test
public void testSomething()
{
new expectations() {{
mocked.doSomething();
}};
callSomething(mocked);
}
}
The issue is that mocked always turns out to be null because it is declared as static. Can this be overridden?
Upvotes: 0
Views: 113
Reputation: 16380
No, @Mocked
and the other mocking annotations only apply to instance fields of the test class (and to test method parameters as well).
Upvotes: 1