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

Closed
rliesenfeld opened this Issue Oct 29, 2015 · 0 comments

Comments

1 participant
@rliesenfeld
Member

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;
    base.doSomething("test");

    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.

@rliesenfeld rliesenfeld self-assigned this Oct 29, 2015

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