Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AssertJ -> AssertK #13841

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamesonwilliams
Copy link
Contributor

@jamesonwilliams jamesonwilliams commented Dec 13, 2024

Contributor checklist

  • MacBook Pro
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

It's handy to have a fluent assertions library in a test suite. There are many examples of such libraries (Hamcrest, AssertJ, AssertK, Strikt, etc.)

Currently, the codebase contains both AssertJ and Hamcrest, which are older libraries that were designed for Java. Each one has little API papercuts when using them from Kotlin, e.g., `is` or `as` needing the backticks.

Newer solutions like AssertK and Strikt have been designed from scratch with Kotlin in mind. AssertK is a little more popular and feature rich, and seems like a great drop-in replacement for AssertJ.

To get started, since there a small number of uses of AssertJ at this time, we can swap it out for AssertK. To do so, I had to convert these three tests to Kotlin:

  1. app/src/test/java/org/thoughtcrime/securesms/groups/v2/GroupInviteLinkUrl_InvalidGroupLinkException_Test.kt
  2. app/src/test/java/org/thoughtcrime/securesms/payments/MobileCoinPublicAddressProfileUtilTest.kt
  3. app/src/test/java/org/thoughtcrime/securesms/util/livedata/LiveDataUtilTest_skip.kt

But, once we have AssertK in the codebase, we can also start replacing Hamcrest and eventually remove it, too.

Testing

./gradlew qa
[..snip...]
BUILD SUCCESSFUL in 8m 39s

@greyson-signal
Copy link
Contributor

Seems reasonable to me, thanks!

@greyson-signal
Copy link
Contributor

Yeah, the junit-boms are a total mystery. If you can figure out where the usages are coming from let us know, because our normal tools are failing us :p

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants