google-ads-java icon indicating copy to clipboard operation
google-ads-java copied to clipboard

Resolve pr 846 comments

Open bobhancockg opened this issue 7 months ago • 0 comments

Here's a summary of the key changes I made in AddDemandGenCampaign.java:

  • I removed an API version comment.
  • I updated the command line argument flags to use ArgumentNames constants.
  • I modified the parameter parsing to allow hardcoding of your customer ID and video ID if you don't provide them via the command line.
  • I initialized GoogleAdsClient to null.
  • I removed unnecessary return statements after System.exit().
  • I added a name to the Ad being created.
  • I removed the business name and call to action text from Ad creation.
  • I ensured the correct .build() call for AdGroupAdOperation.
  • I made helper methods static for better encapsulation.

And here are the key changes in AddDemandGenCampaignTest.java:

  • I updated it to use temporary ID constants from AddDemandGenCampaign.java.

Please note: I couldn't verify the tests due to a build environment incompatibility (Gradle version 7.6.4 and Java version 21). However, the code changes themselves are based on the review feedback.

Refactor: Ensure Demand Gen example constants are public and used by test

This commit addresses your feedback regarding the synchronization of temporary ID constants between AddDemandGenCampaign.java and its test file, AddDemandGenCampaignTest.java.

  • Constants in AddDemandGenCampaign.java (BUDGET_TEMPORARY_ID, CAMPAIGN_TEMPORARY_ID, AD_GROUP_TEMPORARY_ID, LOGO_ASSET_TEMPORARY_ID, VIDEO_ASSET_TEMPORARY_ID) are now explicitly public static final long.
  • AddDemandGenCampaignTest.java has been verified to use these public constants, with local definitions removed.

This ensures that the test file correctly references the authoritative constants from the main example class.

Note: I am still unable to run tests due to a build environment incompatibility (Gradle version 7.6.4 and Java version 21).

bobhancockg avatar Jun 13 '25 13:06 bobhancockg