# 在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到方法 testImplementation()，参数为 [junit:junit:4.13.2]。

- **ID:** `java/gradle-missing-test-framework`
- **领域:** java
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在未应用 Java 插件的项目中使用了 'testImplementation' 配置，该插件提供测试配置。

## 版本兼容性

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

## 解决方案

1. **Apply the Java plugin to the project** (95% 成功率)
   ```
   plugins { id 'java' }
   ```
2. **Use the 'test' configuration if the Java plugin is not desired (deprecated)** (70% 成功率)
   ```
   testCompile 'junit:junit:4.13.2' (though deprecated, works in older Gradle)
   ```

## 无效尝试

- **Adding testImplementation to the root project without applying the Java plugin** — The test configuration is only available after applying the Java plugin. (90% 失败率)
- **Using compileOnly instead of testImplementation** — compileOnly does not include the dependency in the test classpath. (85% 失败率)
