-
Notifications
You must be signed in to change notification settings - Fork 25k
Convert RootViewTest to Kotlin #37227
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D45526517 |
cortinico
added a commit
to cortinico/react-native
that referenced
this pull request
May 3, 2023
Summary: Pull Request resolved: facebook#37227 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: D45526517 fbshipit-source-id: 681482f3445fa4f0153a40ddbdf50a13cb5d35f2
c4f8235 to
58bb00d
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D45526517 |
Base commit: ab3a2f4 |
Summary: Pull Request resolved: facebook#37227 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: D45526517 fbshipit-source-id: 25545883eaa88cae5f6603670767fcca059a82a4
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D45526517 |
58bb00d to
3c70ef9
Compare
Contributor
|
This pull request has been merged in 71fbb0c. |
Contributor
|
This pull request has been reverted by fe5455b. |
jeongshin
pushed a commit
to jeongshin/react-native
that referenced
this pull request
May 7, 2023
Summary: Pull Request resolved: facebook#37227 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: D45526517 fbshipit-source-id: e0cf650126659fdc8676fb32e1617ad51ca14e11
30 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
Reverted
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
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:
mActivity->activity)get:Rulerather than justRule.import org.powermock.api.mockito.PowerMockito.whenas wheneverto avoid having to escape all thewhenfunction invocation in the code as it's a keyword.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
Differential Revision: D45526517