googleapis / gapic-generator

Tools for generating API client libraries from API Service Configuration descriptions.
Apache License 2.0
305 stars 129 forks source link

fix: use separate value generator in test generation #3294

Closed yihanzhen closed 4 years ago

yihanzhen commented 4 years ago

Sometimes a library has two requests methods with a field of the same name but different types. The TestValueGenerator keys on the short name of fields, and reuses a generated value if it has generated a value for this key (short field name). Therefore in such cases it may try to assign a string literal to a integer type.

Change to create a different TestValueGenerator for every single test case generation to avoid such cases.

codecov[bot] commented 4 years ago

Codecov Report

Merging #3294 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3294   +/-   ##
=========================================
  Coverage     87.14%   87.14%           
  Complexity     6105     6105           
=========================================
  Files           495      495           
  Lines         24146    24146           
  Branches       2628     2628           
=========================================
  Hits          21041    21041           
  Misses         2242     2242           
  Partials        863      863           
Impacted Files Coverage Δ Complexity Δ
...e/api/codegen/transformer/TestCaseTransformer.java 98.59% <100.00%> (ø) 54.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3162638...e3db2bf. Read the comment docs.