Increase code coverage for Open AI Client Builder#44790
Increase code coverage for Open AI Client Builder#44790v-lrdev wants to merge 5 commits intoAzure:mainfrom
Conversation
|
Thank you for your contribution @v-lrdev! We will review the pull request and get back to you soon. |
|
API change check API changes are not detected in this pull request. |
jpalvarezl
left a comment
There was a problem hiding this comment.
This looks good. There is a couple of comments, but I would defer to @mssfang to provide guidance here in terms of whether we should go as far as using reflections to see that we are setting the right objects in the builder. Thank you!
| import com.azure.core.credential.AccessToken; | ||
| import com.azure.core.credential.AzureKeyCredential; | ||
| import com.azure.core.credential.TokenCredential; | ||
| import com.azure.core.http.*; |
There was a problem hiding this comment.
I think you will need to expand the star imports, as the style check script will probably not like it
| assertNotNull(client, "The client should not be null"); | ||
|
|
||
| // Access private fields using reflection | ||
| Field endpointField = OpenAIClientBuilder.class.getDeclaredField("endpoint"); |
There was a problem hiding this comment.
We may want to be a bit more careful here, most of the methods and member variables in OpenAIClientBuilder are generated so they are not succeptible to change much, I think. But in the given case that endpoint no longer exists as such, what would be the behaviour of this test? Is this when NoSuchFieldException is thrown?
| .collect(Collectors.toList()); | ||
|
|
||
| assertTrue(pipelinePolicies.contains(customPolicy)); | ||
| } catch (NoSuchFieldException | IllegalAccessException e) { |
There was a problem hiding this comment.
I think it's best if we move these to be thrown in the method signature, like you've done for the other tests.
Description
This PR adds unit tests for the OpenAIClientBuilder class to verify the correct behavior of its methods, including:
Changes