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

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

Projects

None yet

1 participant

@rliesenfeld
Member
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