Skip to content

Commit

Permalink
Re-land: Convert RootViewTest to Kotlin (#37250)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37250

This is a re-land of a previous commit which ended up in us losing the history
of the Java file. This new PR should not be doing so.

This is a reference PR on how to convert a JVM Unit test from Java to Kotlin.
A couple of things to keep in mind when converting:
1. Do not use hungarian notation (`mActivity` -> `activity`)
2. JUnit rules need to be annotated with `get:Rule` rather than just `Rule`.
3. Use `import org.powermock.api.mockito.PowerMockito.`when` as whenever`to avoid having to escape all the `when` function invocation in the code as it's a keyword.
4. Do static imports of all the Mockito/PowerMock functions.

Getting rid of PowerMock and using Fakes is a plus, but that's not always possible. Having the test running and be green is already a good result.

Changelog:
[Internal] [Changed] - Convert RootViewTest to Kotlin

Reviewed By: cipolleschi

Differential Revision: D45565375

fbshipit-source-id: 6c01d037e04dc1ec0003263177d86079a6f19a04
  • Loading branch information
cortinico authored and facebook-github-bot committed May 4, 2023
1 parent fe5455b commit 4c91e8a
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 266 deletions.

This file was deleted.

Loading

0 comments on commit 4c91e8a

Please sign in to comment.