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

It silently does not mock private methods #38

Open
fvovan opened this issue Jun 10, 2016 · 3 comments
Open

It silently does not mock private methods #38

fvovan opened this issue Jun 10, 2016 · 3 comments

Comments

@fvovan
Copy link

fvovan commented Jun 10, 2016

Not sure if it's required but it would be good to throw on such attempts.

@tomaszdurka
Copy link
Owner

Well, it is not possible to mock neither final nor private methods currently.

Current Mocka is fully based on inheritance. So mocking methods means we override parent method with child's one. In case of private method we would need to change the parent's method directly to make any effect.
Mocking (defining) private method in child class would not change anything as usage in parent class would always trigger parent's method.

It would be possible with new approach (implemented in #37) which allows redefining methods without creating child class. You could finally effectively mock/stub/redefine private method then.

@fvovan wdyt?

@fvovan
Copy link
Author

fvovan commented Jun 14, 2016

aha.. for some reasons i thought it uses reflection API.
but is #37 merged and included to CM distribution?

@tomaszdurka
Copy link
Owner

Well, no merged yet, actually even pull-request is not pushed as I see. Will keep you posted.

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

No branches or pull requests

2 participants