MockedTypeCascade:230 NPE #353

Closed
Milbor opened this Issue Oct 10, 2016 · 1 comment

Projects

None yet

2 participants

@Milbor
Milbor commented Oct 10, 2016
public class JMockitTest {
    @Injectable
    private Manager manager;
    @Injectable
    private User user;

    interface Manager {
        <T extends Entity> T find(Class<T> clazz);
    }

    interface Entity {
    }

    static class User implements Entity {
    }

    @Test
    public void test() throws Exception {
        new Expectations() {{
            manager.find(User.class);
            result = user;
        }};
        final Entity actual = manager.find(User.class);
        assertSame(actual, user);
    }
}

produces NPE in MockedTypeCascade.getGenericReturnType, version 1.28, 1.25. Is this not supported? Thank you.

@rliesenfeld rliesenfeld added the bug label Oct 10, 2016
@rliesenfeld rliesenfeld self-assigned this Oct 10, 2016
@rliesenfeld
Member

Thanks for reporting, it's a bug.

@rliesenfeld rliesenfeld added a commit that closed this issue Oct 12, 2016
@rliesenfeld rliesenfeld Fixed bug where a NPE occurred on an attempt to cascade from a generi…
…c method of a mocked non-public interface; closes #353.
e563ef6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment