• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mockito: Wanted but not invoked  RSS feed

 
Ashwin Ganesh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When verify method of Mockito class gets called, I am getting wanted but not invoked error in jUnit?
I understand that the  REST API call is not happening. But I would like to know the reason, of where I have slipped out.
Can anyone please assist me on this?






 
Junilu Lacar
Sheriff
Posts: 11435
176
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You declare a ScenarioDeploymentController as a fixture and use @InjectMocks to autowire it. However, you don't have any instance to autowire. Mokito won't report an error though and just keep going.

See this article: https://tedvinke.wordpress.com/2014/02/13/mockito-why-you-should-not-use-injectmocks-annotation-to-autowire-fields/
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!