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

Support mocking kotlin suspend functions compiled by Kotlin 1.3 (#1500) #1501

Merged
merged 2 commits into from
Oct 5, 2018

Conversation

dzharkov
Copy link
Contributor

@dzharkov dzharkov commented Sep 27, 2018

This is an update for #1032

Coroutines support is not experimental anymore and a type of continuation-parameter is renamed to kotlin.coroutines.Continuation

This PR is assumed to fix #1500

… by Kotlin 1.3

Coroutines support is not experimental anymore and a type
of continuation-parameter is renamed to kotlin.coroutines.Continuation
testCompile libraries.junit4

testCompile "org.jetbrains.kotlin:kotlin-stdlib:1.3.0-rc-57"
testCompile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.26.1-eap13'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using dependencies.gradle to define our dependencies (https://github.com/mockito/mockito/blob/release/2.x/gradle/dependencies.gradle). Could you use the same format as https://github.com/mockito/mockito/blob/release/2.x/subprojects/kotlinTest/kotlinTest.gradle and add the extra dependency in dependencies.gradle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course, I can.
I haven't done that just to avoid introducing the version used only within a single test module

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you resolve this comment? Then I think this is ready for a merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@codecov-io
Copy link

codecov-io commented Sep 27, 2018

Codecov Report

Merging #1501 into release/2.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                @@
##             release/2.x    #1501      +/-   ##
=================================================
+ Coverage          88.58%   88.59%   +<.01%     
- Complexity          2398     2401       +3     
=================================================
  Files                299      299              
  Lines               6037     6039       +2     
  Branches             732      733       +1     
=================================================
+ Hits                5348     5350       +2     
  Misses               510      510              
  Partials             179      179
Impacted Files Coverage Δ Complexity Δ
...a/org/mockito/internal/creation/SuspendMethod.java 85.71% <100%> (+5.71%) 6 <3> (+3) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6038e7...aa54bd6. Read the comment docs.

@TimvdLippe TimvdLippe merged commit 8d2b9b2 into mockito:release/2.x Oct 5, 2018
@raphw
Copy link
Member

raphw commented Oct 5, 2018

@TimvdLippe Could you just also release to MC? Otherwise I will do it tonight.

@TimvdLippe
Copy link
Contributor

@raphw Yup doing that right now 😄

@TimvdLippe
Copy link
Contributor

2.23.0 is now being pushed to Maven central. It should show up in the next hour.

@dzharkov
Copy link
Contributor Author

dzharkov commented Oct 5, 2018

@TimvdLippe Cool, thanks!

@asarkar
Copy link

asarkar commented Sep 21, 2020

Mocked suspending function returns null with v3.3.3, and this PR is referenced from this SO thread as a solution. Shall I open a new ticket?

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

Successfully merging this pull request may close these issues.

Mockito 2.x.x does not support Kotlin release coroutines
7 participants