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

[BUG] Mix of junit4 and junit5 in Java generator 7.5.0 #18465

Closed
thorstenhirsch opened this issue Apr 23, 2024 · 6 comments · Fixed by #18741
Closed

[BUG] Mix of junit4 and junit5 in Java generator 7.5.0 #18465

thorstenhirsch opened this issue Apr 23, 2024 · 6 comments · Fixed by #18741

Comments

@thorstenhirsch
Copy link
Contributor

Description

While the model tests use JUnit 5 (import org.junit.jupiter.api.Test) the api tests still use JUnit 4 (import org.junit.Test).

openapi-generator version

7.5.0

OpenAPI declaration file content or url

Any OpenAPI.json should reproduce the problem.

Generation Details
java -jar openapi-generator-cli-7.5.0.jar generate -i ./MyOpenAPI.json -g java -o genc --additional-properties library=native,serializableModel=true,hideGenerationTimestamp=true,useJakartaEe=true
Steps to reproduce
  1. Generate Java code
  2. mvn clean test
Related issues/PRs

n/a

Suggest a fix

Fix the code that generates the API tests.

@wing328
Copy link
Member

wing328 commented Apr 23, 2024

thanks for reporting the issue. may i know if you've time to contribute a fix with a PR?

@thorstenhirsch
Copy link
Contributor Author

Maybe... can't promise anything regarding the timeframe.
But 1st of all, here's a simple json to reproduce the issue.
MyOpenAPI.json

@bijancn
Copy link
Contributor

bijancn commented May 22, 2024

So I just tested 7.6.0 which contained some of these fixes but I'm still getting test compilation errors like:

[ERROR] /runner/_work/openapi-client-generator-action/openapi-client-generator-action/client_generation_scripts/gen/java/src/test/java/com/jimdo/openapiclientgeneratoractiontestopenapijavawebclientclient/OnboardingDisconnectErrorResponseTest.java:[21,29] 
package org.junit.jupiter.api does not exist
...
[ERROR] /runner/_work/openapi-client-generator-action/openapi-client-generator-action/client_generation_scripts/gen/java/src/test/java/com/jimdo/openapiclientgeneratoractiontestopenapijavawebclientclient/OnboardingDisconnectErrorResponseTest.java:[34,6]
cannot find symbol
  symbol:   class Test
  location: class 
...

@wing328
Copy link
Member

wing328 commented May 22, 2024

@bijancn may I know which generator/library did you test?

@bijancn
Copy link
Contributor

bijancn commented May 22, 2024

@wing328 yes of course, we are using the docker image openapitools/openapi-generator-cli:7.6.0 with -g java and "--additional-properties=library=webclient". If you can't reproduce this, I can try to make a minimal reproducer from our full setup.

@wing328
Copy link
Member

wing328 commented May 23, 2024

update: filed #18741 to fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants