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

InvocationFactory.createInvocation's realmethod cannot throw a Throwable #1306

Closed
moltmann opened this issue Feb 6, 2018 · 0 comments
Closed

Comments

@moltmann
Copy link
Contributor

moltmann commented Feb 6, 2018

InvocationFactory.createInvocation takes a Callable that is used to call the real method of the Invocation. If the Invocation throws an Exception the Exception is forwarded from the Callable. Unfortunately Callable can only throw an Exception, not a Throwable.

Hence if the real method throws a Throwable that is neither an Error, RuntimeException or Exception it cannot be forwarded.

I recommend for InvocationFactory.createInvocation to take realMethod argument that can throw a full Throwable.

This is required for fixing: linkedin/dexmaker#64

moltmann added a commit to moltmann/mockito that referenced this issue Feb 6, 2018
A real method might throw a Throwable, but the invocations produced by
InvocationFactory call the real method via a Callable that can only
throw a Exception.

Hence add a new method to InvocationFactory that allows to create
invocations with a RealMethodBehavior == a Callable that throws a
Throwable.
moltmann added a commit to moltmann/mockito that referenced this issue Feb 6, 2018
A real method might throw a Throwable, but the invocations produced by
InvocationFactory call the real method via a Callable that can only
throw a Exception.

Hence add a new method to InvocationFactory that allows to create
invocations with a RealMethodBehavior == a Callable that throws a
Throwable.
moltmann added a commit to moltmann/mockito that referenced this issue Feb 6, 2018
A real method might throw a Throwable, but the invocations produced by
InvocationFactory call the real method via a Callable that can only
throw a Exception.

Hence add a new method to InvocationFactory that allows to create
invocations with a RealMethodBehavior == a Callable that throws a
Throwable.
moltmann added a commit to moltmann/mockito that referenced this issue Feb 6, 2018
A real method might throw a Throwable, but the invocations produced by
InvocationFactory call the real method via a Callable that can only
throw a Exception.

Hence add a new method to InvocationFactory that allows to create
invocations with a RealMethodBehavior == a Callable that throws a
Throwable.
mockitoguy added a commit that referenced this issue Feb 9, 2018
Fixes #1306: Invocation's real method throws Throwable
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

1 participant