Skip to content

Generics doesn't work properly in chained method calls #213

@ChristophLu

Description

@ChristophLu

With JMockit 1.19 I have the following test code:

public class MockTest {
    public interface Baz {
    }

    public interface Bar {

        public Baz getBaz(String name);
    }

    public interface Foo {

        public <DataT> Bar getBar(DataT model); // this does not work: "baz" is null
        // public Bar getBar(String model); // this works!
    }

    @Test
    public void test_cascading_class(@Mocked Foo foo) {
        assertNotNull(foo);
        final Bar bar = foo.getBar("blah");
        assertNotNull(bar);
        final Baz baz = bar.getBaz("foo"); // "baz" is null
        assertNotNull(baz);
    }
}

The third assertion is null if using getBar() with generics. If I use the method without generics all works fine.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions