org.mockito.exceptions.verification.WantedButNotInvoked: Wanted but not invoked
verify(mock).method() did not find that call.
Exact message you may see
Wanted but not invokedActually, there were zero interactions with this mock
Seen on:
Java
Meaning
The message lists the wanted call and the actual interactions. Argument differences are shown as "Actual invocation has different arguments".
Common causes
- Method never called
- Called with different arguments
- Called on another mock instance
- Mock injected into the wrong field
⚡ Quick fix
- Compare "Wanted" and "Actual" lines
- Use matchers (
any(),eq()) consistently - Check @InjectMocks wiring
Detailed fix by platform
Mockito
verify(service).send(eq("a@b.c"), any());
How to diagnose
- Wanted — Which call?
- Actual — Which interactions?
- Mock — Same instance?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Most viewed in Java
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 2 Dec 2026