This parser:
JavaTemplate.builder("#{any(com.azure.cosmos.CosmosClientBuilder)}.endpoint(\"boo\").userAgentSuffix(\"test\").buildAsyncClient()")
.javaParser(JavaParser.fromJavaVersion().classpath("azure-cosmos"))
.build()
Cannot be used to match a method invocation of CosmosClientBuilder.buildAsyncClient() because the method its parser produces lacks type information. CosmosClientBuilder is defined within the jar "azure-cosmos", but also requires "azure-core" for the java compiler to type attribute it.
This is because JavaParser.fromJavaVersion().classpath() does not look up transitive dependencies of the named artifact, so "azure-core" is absent from the classpath.
This test can be used to reproduce the issue. Changing JavaParser.fromJavaVersion().classpath(JavaParser.fromRuntimeClasspath()) resolves this problem because the full runtime classpath has both "azure-cosmos" and "azure-core".