You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Gergely Harmadás (Jira)" <ji...@apache.org> on 2026/10/07 08:23:00 UTC
[jira] [Created] (KAFKA-21237) Remove accidental JUnit 4 usage
Gergely Harmadás created KAFKA-21237:
----------------------------------------
Summary: Remove accidental JUnit 4 usage
Key: KAFKA-21237
URL: https://issues.apache.org/jira/browse/KAFKA-21237
Project: Kafka
Issue Type: Task
Reporter: Gergely Harmadás
Assignee: Gergely Harmadás
Currently [StreamsGroupDescribeRequestTest|https://github.com/apache/kafka/blob/85387e94364bdf31c6acf06086210d85a9fb0711/core/src/test/scala/unit/kafka/server/StreamsGroupDescribeRequestTest.scala#L32] includes accidental JUnit 4 assert usages. Based on my findings:
# Historically KAFKA-7339 had the JUnit 4 to JUnit 5 in scope.
# KAFKA-19153 pulled in a new dependency [Mock OAuth2 Server|https://mvnrepository.com/artifact/no.nav.security/mock-oauth2-server/2.3.0] which in turn depends on JUnit 4
# KAFKA-19754 probably only used the JUnit 4 asserts by accident since the test library is on the test classpath
As a fix I changed the asserts to the JUnit 5 equivalent and removed JUnit 4 from the test compile classpath so we can avoid similar accidents in the future.
Other things I considered:
* JUnit 4 can't be excluded from [Mock OAuth2 Server|https://mvnrepository.com/artifact/no.nav.security/mock-oauth2-server/2.3.0] as it is a runtime dependency which results in NoClassDefFoundError
* Tried updating [Mock OAuth2 Server|https://mvnrepository.com/artifact/no.nav.security/mock-oauth2-server/2.3.0] to latest version but it still pulls in JUnit 4
--
This message was sent by Atlassian Jira
(v8.20.10#820010)