googleapis / sdk-platform-java

Tooling and shared libraries for Cloud SDK for Java
https://cloud.google.com/java/docs/bom
Apache License 2.0
62 stars 50 forks source link

Migrate Junit 4 to Junit 5: update the generator to use JUnit5 when generating unit tests #2762

Open zhumin8 opened 2 months ago

zhumin8 commented 2 months ago

Followup to Junit 4 to 5 migrations in sdk-platform-java, creating to track for future efforts

This effort would introduce changes to google-cloud-java and all handwritten libraries, we need to coordinate the change and update their poms accordingly.

See https://github.com/googleapis/sdk-platform-java/pull/2757#discussion_r1595603832 for context.

lqiu96 commented 1 month ago

As part of these changes, I believe we will need to make a few changes in a few spots:

  1. The generated pom.xml for client libraries will need to be updated to have JUnit5 with test scope: https://github.com/googleapis/sdk-platform-java/blob/7a5fed359062ad725d4eb7c49dfbec5be15bf9b7/library_generation/owlbot/templates/poms/cloud_pom.xml.j2#L85-L89
  2. JUnit5 will need to be added here: https://github.com/googleapis/sdk-platform-java/blob/7a5fed359062ad725d4eb7c49dfbec5be15bf9b7/gapic-generator-java/pom.xml#L446-L450
  3. Static Types for the Test Composer will need to be updated to JUnit5: https://github.com/googleapis/sdk-platform-java/blob/7a5fed359062ad725d4eb7c49dfbec5be15bf9b7/gapic-generator-java/src/main/java/com/google/api/generator/gapic/composer/common/AbstractServiceClientTestClassComposer.java#L902-L930