Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhumin8 opened this issue May 10, 2024 · 1 comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@zhumin8
Copy link
Contributor

zhumin8 commented May 10, 2024

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 #2757 (comment) for context.

@zhumin8 zhumin8 added type: cleanup An internal cleanup or hygiene concern. priority: p3 Desirable enhancement or fix. May not be included in next release. labels May 10, 2024
@blakeli0 blakeli0 added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: cleanup An internal cleanup or hygiene concern. labels May 17, 2024
@lqiu96
Copy link
Contributor

lqiu96 commented May 21, 2024

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:
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <scope>test</scope>
    </dependency>
  2. JUnit5 will need to be added here:
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    </dependency>
  3. Static Types for the Test Composer will need to be updated to JUnit5:
    private static TypeStore createStaticTypes() {
    List<Class<?>> concreteClazzes =
    Arrays.asList(
    AbstractMessage.class,
    After.class,
    AfterClass.class,
    Any.class,
    ApiClientHeaderProvider.class,
    ApiStreamObserver.class,
    Arrays.class,
    Assert.class,
    Before.class,
    BeforeClass.class,
    BidiStreamingCallable.class,
    ClientStreamingCallable.class,
    ExecutionException.class,
    Generated.class,
    IOException.class,
    InvalidArgumentException.class,
    List.class,
    Lists.class,
    NoCredentialsProvider.class,
    Operation.class,
    ServerStreamingCallable.class,
    StatusCode.class,
    Test.class,
    UUID.class);
    return new TypeStore(concreteClazzes);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants