Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Mocking support

オープン
#437 コメント 1 件 リアクション 4 件 担当者 2 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@hemasekhar-p がすでに取り組んでいます。

2026年2月6日 から。

評価

この issue はまだ評価されていません。

説明

priority: p3 type: feature request

Due to the design of the GenAI Client() class it isn't possible to mock it for most use cases.

For example (with Mockito):

Client clientMock = mock(Client.class);
when(clientMock.models).thenReturn(mock(Models.class));

A simple scenario such as this won't work because the models property in Client is final and can only be set through constructors that I also can't override because the class is marked as final. It might be possible to use mockito-inline but this isn't ideal for a number of reasons.

The idiomatic way for the Client class to be defined in Java is for models to be accessed via a getter which would also support basic mocking but other ways to support mocking a Client would be welcome.

主要言語
Java
スター
398
フォーク
126
平均マージ
1日 12時間
マージ済み PR(30日)
71

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleapis/java-genai のほかの issue

googleapis/java-genai の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。