I am using Intellij, and my external dependencies folder show I am using mockito-all-1.10.19.jar.
I am using this simple Mockito example.
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class AuditUnitTests {
@Mock
AuditTwo two;
@InjectMocks
AuditOne one;
@Test
public void test1() {
one.sayHelloFilter("Saurav");
one.sayHelloFilter("Dravid");
one.sayHelloFilter("Sachin");
verify(two, times(2)).sayHello();
}
}
However my Intellij complains that It cannot resolve Mock and InjectMocks annotations. How can I resolve it ?
Note: I am using Ivy for dependency management:
<dependency org="junit" name="junit" rev="4.12" conf="test"/>
<dependency org="org.mockito" name="mockito-all" rev="1.10.19" conf="test"/>
Your static import is not sufficent. You have to add following additional imports.
import org.mockito.InjectMocks;
import org.mockito.Mock;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With