-1

Every single test succeeded. Thought to run the class for testing. But failed with the error unnecessarystubbingexception class

Validating a method using when and thenReturn of mockito.

Progman
  • 16,827
  • 6
  • 33
  • 48
Sai Srujan
  • 27
  • 4
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then [edit] your question to include your source code as a working [mcve], which can be compiled and tested by others. – Progman Apr 04 '22 at 20:07
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 04 '22 at 20:08
  • You might want to check other questions like https://stackoverflow.com/questions/42947613/how-to-resolve-unneccessary-stubbing-exception – Progman Apr 04 '22 at 20:10

1 Answers1

0

This error occurs when you create a Mock that is never called upon. It is dead code and can be removed. Without providing your Code it is however not possible to tell which of your stubbing is never called ;)

GJohannes
  • 1,408
  • 1
  • 8
  • 14