OpenAPITools / OpenAPITools/openapi-generator

Mix of junit4 and junit5 in Java generator in 7.7.0

Open
#19,083 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the supplied openapi-generator-cli command and inspect the generated Java test class and its JUnit dependency. Read PR 18741 and issue 18465 for context, then verify that the generated tests and declared dependency use a consistent JUnit version and that the generated library builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.