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

@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
Assignees
Labels
bug

Comments

@rliesenfeld
Copy link
Member

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

Copy link

@nothize 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
2 participants
You can’t perform that action at this time.