OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.67k stars 6.3k forks source link

Mix of junit4 and junit5 in Java generator in 7.7.0 #19083

Open MrudulaAmirneni opened 1 week ago

MrudulaAmirneni commented 1 week ago

Bug Report Checklist

Description

I am getting this error when I am trying to build the library using 7.7.0 version

error: package org.junit.jupiter.api does not exist import org.junit.jupiter.api.Test;

Inside the test class I see import org.junit.jupiter.api.Test; but the API is referring to junit4. I see that this issue has been fixed in 7.6.0 using this PR https://github.com/OpenAPITools/openapi-generator/pull/18741, but I am getting the same error even with 7.7.0.

openapi-generator version
7.7.0 ##### OpenAPI declaration file content or url
Generation Details

openapi-generator-cli generate \ -i ./api/swagger/swagger.yaml \ -g java \ --additional-properties useRxJava2=true,serializableModel=true,dateLibrary=java11,hideGenerationTimestamp=true,booleanGetterPrefix=is,sortParamsByRequiredFlag=false \

Steps to reproduce
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/18465

Suggest a fix
wing328 commented 6 days ago

i tested with

 java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml --additional-properties useRxJava2=true,serializableModel=true,dateLibrary=java11,hideGenerationTimestamp=true,booleanGetterPrefix=is,sortParamsByRequiredFlag=false -o /tmp/output23/

and the output compiles without issues.