googleapis / googleapis/google-cloud-java

[sdk-platform-java] Client libraries should be mockable for testing

Open
#12,510 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
Java
Stars
2.1k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
154

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.