# 参数匹配器使用无效：预期 0 个匹配器，但记录了 1 个

- **ID:** `java/mockito-wrong-type-argument`
- **领域:** java
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在同一方法调用中混合使用匹配器和精确值，或在 when/verify 之外使用匹配器。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 8+ | active | — | — |

## 解决方案

1. **Use matchers for all parameters consistently** (95% 成功率)
   ```
   when(mock.method(anyString(), anyInt())).thenReturn(value);
   ```
2. **Use eq() for exact values with matchers** (90% 成功率)
   ```
   when(mock.method(eq("exact"), anyInt())).thenReturn(value);
   ```

## 无效尝试

- **Using any() for all parameters** — May cause UnnecessaryStubbingException if not all used. (50% 失败率)
- **Removing matchers and using exact values only** — Reduces test flexibility; may not match actual calls. (40% 失败率)
