osglworks / java-tool

Some simple common Java utilities
Apache License 2.0
52 stars 18 forks source link

$.map failed to apply filter #177

Closed greenlaw110 closed 5 years ago

greenlaw110 commented 5 years ago

Test case:

public class Gh177 extends TestBase {

    public static class Foo {
        Bar bar;
        public Foo() {}
        public Foo(Bar bar) {
            this.bar = bar;
        }
    }

    public static class Bar {
        String name;
        int id;
        public Bar() {}
        public Bar(String name, int id) {
            this.name = name;
            this.id = id;
        }
    }

    @Test
    public void test() {
        Foo foo = $.map(new Foo(new Bar("abc", 123))).filter("-bar.name").to(Foo.class);
        Bar bar = foo.bar;
        eq(123, bar.id);
        isNull(bar.name); // failed here
    }

}