Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Mockito: Cannot instantiate @InjectMocks field: the type is an interface

Anyone who has used Mockito for mocking and stubbing Java classes, probably is familiar with the InjectMocks-annotation. Use this annotation on your class under test and Mockito will try to inject mocks either by constructor injection, setter injection, or property injection. This magic succeeds, it fails silently or a MockitoException is thrown. I’d like to ...



This post first appeared on Java Code Geeks, please read the originial post: here

Share the post

Mockito: Cannot instantiate @InjectMocks field: the type is an interface

×

Subscribe to Java Code Geeks

Get updates delivered right to your inbox!

Thank you for your subscription

×