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

@Capturing: expectation recorded on method using type parameter from generic base type fails to match #252

Closed
rliesenfeld opened this Issue Jan 26, 2016 · 1 comment

Comments

2 participants
@rliesenfeld
Member

rliesenfeld commented Jan 26, 2016

The following test fails:

public interface Base<T> { T doSomething(); }
static class Impl implements Base<Integer> { public Integer doSomething() { return 1; } }

@Test
public void captureImplementationsOfGenericType(@Capturing final Base<?> anyInstance)
{
    new Expectations() {{ anyInstance.doSomething(); result = 2; }};

    int result = new Impl().doSomething();

    assertEquals(2, result);
}

The implementation class gets mocked (as doSomething() returns zero), but the invocation fails to match the recorded expectation.

@rliesenfeld rliesenfeld added the bug label Jan 26, 2016

@rliesenfeld rliesenfeld self-assigned this Jan 26, 2016

@nothize

This comment has been minimized.

Show comment
Hide comment
@nothize

nothize Jan 27, 2016

Do u have any idea if I may help to fix this issue as it helps me too?

nothize commented Jan 27, 2016

Do u have any idea if I may help to fix this issue as it helps me too?

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