{
  "id": "java/junit-assert-throws-wrong-type",
  "signature": "org.opentest4j.AssertionFailedError: Expected java.lang.RuntimeException to be thrown, but java.lang.NullPointerException was thrown",
  "signature_zh": "断言失败错误：期望抛出 java.lang.RuntimeException，但实际抛出了 java.lang.NullPointerException",
  "regex": "org\\.opentest4j\\.AssertionFailedError:\\ Expected\\ java\\.lang\\.RuntimeException\\ to\\ be\\ thrown,\\ but\\ java\\.lang\\.NullPointerException\\ was\\ thrown",
  "domain": "java",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "assertThrows expects a specific exception type, but a different exception is thrown.",
  "root_cause_type": "generic",
  "root_cause_zh": "assertThrows 期望特定的异常类型，但抛出了不同的异常。",
  "versions": [
    {
      "version": "8+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Catching the actual exception and ignoring",
      "why_fails": "Test passes incorrectly; real exception type mismatch is hidden.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Changing expected type to Exception",
      "why_fails": "Too broad; may hide other issues.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use assertThrows with correct exception type",
      "success_rate": 0.95,
      "how": "assertThrows(NullPointerException.class, () -> {\n    // code that throws NPE\n});",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use assertThrowsAny for multiple exception types",
      "success_rate": 0.8,
      "how": "assertThrowsAny(RuntimeException.class, () -> {\n    // code\n});",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}