googleapis / googleapis/google-cloud-java
[sdk-platform-java] Client libraries should be mockable for testing
- 主要语言
- Java
- 星标
- 2.1k
- 派生
- 1.2k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 157
描述
**Is your feature request related to a problem? Please describe.**
I am attempting to write JUnit tests for my code that integrates with Dialogflow CX. However, the `SessionsClient` does not implement a service interface, and the business methods (particularly `detectIntent(DetectIntentRequest)`) are all `final`. This means that it is impossible to use a test double, either a JDK interface proxy or a CGLib subclass.
**Describe the solution you'd like**
The service APIs should implement a business service interface that can be mocked.
**Describe alternatives you've considered**
No alternatives considered; this is fundamental baseline functionality for an integration library.
贡献指南
调研方向
从 Dialogflow CX SessionsClient 入口点及其 detectIntent(DetectIntentRequest) 方法开始,然后审查服务 API 如何为 JUnit 测试提供。定义可模拟服务接口的范围,并验证客户端集成可以使用 JDK 接口代理或 CGLib 子类作为测试替身。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api, testing
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100