[
https://issues.apache.org/jira/browse/KAFKA-16929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853874#comment-17853874
]
Chia-Ping Tsai commented on KAFKA-16929:
----------------------------------------
{quote}
We could consider something like
[https://docs.openrewrite.org/recipes/java/testing/assertj/junittoassertj] if
we think assertj (or hamcrest) is better than the built-in assertions.
{quote}
I will take a look, thanks for this information
> Conside defining kafka-specified assertion to unify testing style
> -----------------------------------------------------------------
>
> Key: KAFKA-16929
> URL: https://issues.apache.org/jira/browse/KAFKA-16929
> Project: Kafka
> Issue Type: Wish
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Major
>
> There are many contributors who trying to fix chaos of kafka testing. That
> includes following huge works:
> # replace powermock/easymock by mockito (KAFKA-7438)
> # replace junit 4 assertion by junit 5 (KAFKA-7339)
> We take 6 years to complete the migration for task 1. The second task is in
> progress and I hope it can be addressed in 4.0.0
> When reviewing I noticed there are many different tastes in code base. That
> is why the task 1 is such difficult to rewrite. Now, the rewriting of
> "assertion" is facing the same issue, and I feel the usage of "assertion" is
> even more awkward than "mockito" due to following reason.
> # there are two "different" assertion style in code base - hamcrest and
> junit - that is confused to developers
> #
> [https://github.com/apache/kafka/pull/15730#discussion_r1567676845|https://github.com/apache/kafka/pull/15730#discussion_r1567676845)]
> # third-party assertion does not offer good error message, so we need to use
> non-common style to get useful output
> [https://github.com/apache/kafka/pull/16253#discussion_r1633406693|https://github.com/apache/kafka/pull/16253#discussion_r1633406693)]
> IMHO, we should consider having our kafka-specified assertion style. Than can
> bring following benefit.
> # unify the assertion style of whole project
> # apply customized assertion. for example:
> ## assertEqual(List<Y>, List<K>, F<K, Y>))
> ## assertTrue(Supplier<B>, Duration) - equal to `TestUtils.waitForCondition`
> # auto-generate useful error message. For example: assertEqual(0, list) ->
> print the list
> In short, I'd like to add a new module to define common assertions, and then
> apply it to code base slowly.
> All feedback/responses/objections are welcomed :)
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)