-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Hi,
I'm reporting a bug in the auto-generated test files that prevents compilation when multiple convenience method overloads exist.
Issue Description:
When the generator creates test files for operations with pagination parameters, it generates method calls with null parameters that result in ambiguous method call errors during compilation.
PR: https://github.com/Azure/azure-rest-api-specs/pull/40714/changes
Location:
Repository: azure-rest-api-specs
Specification: KeyVault Certificates (2025-06-01-preview)
Generated test files:
GetCertificateIssuersTests.java
GetCertificateVersionsTests.java
Problem Details:
The generator creates overloaded convenience methods in the client:
// Both methods exist:
- getCertificateIssuers(RequestOptions requestOptions) // Low-level API
- getCertificateIssuers(Integer maxresults) // Convenience method
But the generated test calls them with null:
PagedIterable response = keyVaultClient.getCertificateIssuers(null);
This creates an ambiguous method reference compilation error because null can match either parameter type.
Expected Behavior:
Generated tests should either:
- Use the parameterless convenience method overload (if available), or
- Pass the correct typed parameter, or
- Explicitly cast the null to avoid ambiguity
Reproducibility:
Generate Java SDK from KeyVault Certificates specification (API version 2025-06-01-preview) and run mvn test on the generated project.