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

Feature: Add a way to verify constructor is called with defined values #735

Open
3 tasks done
devilk10 opened this issue Nov 3, 2021 · 8 comments
Open
3 tasks done

Comments

@devilk10
Copy link

devilk10 commented Nov 3, 2021

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

We can mock constructor and verify if a method was called on that mock class, here
But there is no way to verify if a Constructor was called with defined parameter

class MockCls(private val a: Int = 0) {}

mockkConstructor(MockCls::class)

verifyNew(constructedWith<MockCls>("2"))
@devilk10
Copy link
Author

devilk10 commented Nov 3, 2021

This issue is different from 209

@yanjiepeng
Copy link

did it solved?

@cmaier
Copy link

cmaier commented Mar 12, 2022

That one would be nice!

@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are sure that this issue is important and should not be marked as stale just ask to put an important label.

@stale stale bot added the stale label Jul 10, 2022
@LKorso
Copy link

LKorso commented Oct 20, 2022

Hi, I would also like this feature to be included in the library.

@Sti2nd
Copy link

Sti2nd commented Aug 2, 2023

This issue should have important label

@victorhsr
Copy link

This issue should have important label

Agreed, something like mockito's mockConstruction would be great. There are many cases where we need to validate the arguments used to instantiate an object

@AkramKMansour
Copy link

Is anyone aware of any updates on this? I too think it would be nice for this functionality to be added.

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

No branches or pull requests

8 participants