Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Migrate all Java/Hamcrest tests to Kotlin/AssertK #13884

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

Conversation

jamesonwilliams
Copy link
Contributor

Contributor checklist

  • MacBook, to run unit tests
  • 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

I'm working towards removing Hamcrest from the project, and replacing it with AssertK. Likewise, I've been working on migrating all of the Java tests to Kotlin.

The goal of this current PR is to:

  • Find any/all Java tests mentioning hamcrest
  • Convert them to Kotlin & clean them up
  • Replace their use of Hamcrest with AssertK

To find them, I did:

rg -i hamcrest $(git ls-files "*.java")

These were the tests that met those conditions:

  1. app/src/test/java/org/thoughtcrime/securesms/contacts/SelectedContactSetTest.kt
  2. app/src/test/java/org/thoughtcrime/securesms/groups/v2/ProfileKeySetTest.kt
  3. app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/GroupStatePatcherTest.kt
  4. app/src/test/java/org/thoughtcrime/securesms/groups/v2/processing/StateChainTest.kt
  5. app/src/test/java/org/thoughtcrime/securesms/l10n/SupportArticleTest.kt
  6. app/src/test/java/org/thoughtcrime/securesms/recipients/RecipientIdSerializationTest.kt
  7. app/src/test/java/org/thoughtcrime/securesms/service/webrtc/collections/ParticipantCollectionTest.kt
  8. libsignal-service/src/test/java/org/whispersystems/signalservice/api/groupsv2/DecryptedGroupUtilTest.kt
  9. libsignal-service/src/test/java/org/whispersystems/signalservice/api/groupsv2/GroupsV2Operations_ban_Test.kt

After the changes, I validated that ./gradlew qa is still passing:

$ ./gradlew qa 
[...snip...]

And that there are no longer any files that match the search:

$ rg -i hamcrest $(git ls-files "*.java") | wc -l 
       0

@greyson-signal
Copy link
Contributor

Awesome, thank you! Will go out in 7.30

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

Successfully merging this pull request may close these issues.

2 participants