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 with StrictExpectations wrong mocking #445

Milbor-zz opened this issue Aug 15, 2017 · 0 comments

Capturing with StrictExpectations wrong mocking #445

Milbor-zz opened this issue Aug 15, 2017 · 0 comments


Copy link

@Milbor-zz Milbor-zz commented Aug 15, 2017

1.33 fail
1.28 pass

import org.testng.annotations.Test;

import mockit.Capturing;
import mockit.StrictExpectations;

import static org.testng.Assert.assertEquals;

public class JmockitTest {
    private Manager manager;

    public void test() throws Exception {
        final String expected = "expected";
        new StrictExpectations() {{//passes with Expectations
            result = expected;
        final String actual = getManager().find(String.class);
        assertEquals(actual, expected);//is null

    private Manager getManager() {
        return new Manager() {
            public <T> T find(final Class<T> clazz) {
                throw new UnsupportedOperationException();

    public interface SuperManager {
        <T> T find(Class<T> clazz);

    public /*passes with package visibility*/ interface Manager extends SuperManager {
@rliesenfeld rliesenfeld self-assigned this Aug 15, 2017
@jmockit jmockit locked and limited conversation to collaborators Oct 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

No branches or pull requests

2 participants