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

@Mocked: add support for generic interface methods overridden in a sub-interface #231

rliesenfeld opened this issue Oct 29, 2015 · 0 comments


Copy link

@rliesenfeld rliesenfeld commented Oct 29, 2015

interface BaseInterface<T> { void doSomething(T t) throws Exception; }
interface SubInterface extends BaseInterface<String> { /** Extra API documentation. */ @Override void doSomething(String s); }

@Test // currently fails
public void invokeGenericBaseInterfaceMethodThatIsOverriddenInMockedSubInterface(@Mocked final SubInterface mock) throws Exception {
    BaseInterface<String> base = mock;

    new Verifications() {{ mock.doSomething("test"); }};

In this situation, the implementation class (for interfaces that are public or not) has two methods, one having a generic signature and the other not. Probably, the implementation generated for the first one will have to delegate to the second.

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

No branches or pull requests

1 participant