yandex-qatools / hamcrest-pojo-matcher-generator

Autogenerated java hamcrest matchers for pojo with help of AnnotationProcessor
Apache License 2.0
33 stars 8 forks source link

Integration with https://immutables.github.io/ #27

Open anton-tregubov opened 7 years ago

anton-tregubov commented 7 years ago

I think that https://immutables.github.io/ is greatest tool for generating PoJo. Your tool can let developers (lazy developers) focus on effectve test instead of "near support" code.

I look at your sources? and see that you filter

private static Stream<Element> asFields(Element element) {
        switch (element.getKind()) {
            case FIELD:
                return Stream.of(element);
            case CLASS:
                return element.getEnclosedElements().stream().flatMap(MatcherFactoryGenerator::asFields);
        }
        return Stream.empty();
    }

and

ru.yandex.qatools.processors.matcher.gen.processing.MethodsCollector#asMethodSpec

can take into accoount method (because immutables require to define only methods).

I think i can do it too, but later...

lanwen commented 7 years ago

Yes, I've been thinking a lot about using methods too, but it contains some corner cases we should usually be prepared. So I've put it to the backlog without a deadline. But maybe it's time to start progress on it :)

So if I will start it, I'll write about it here (but I should find some time only after next weekend)

anton-tregubov commented 7 years ago

Start working on feature. (my-fork) Can you give some ideas for

some corner cases

because i change some lines and generator work fine for my cases

lanwen commented 7 years ago

Should generate

Should NOT generate for

(maybe more, but can't remember at this time)

Thanks a lot for your time!

anton-tregubov commented 7 years ago

Если напрягает говорить на родном, скажи, я переведу. Я понял почему я не видел проблем. Я хочу сделать гораздо проще. Добавить поиск методов которые соответствуют BeanProperty понятию. Тоесть get/isXXX свойяствам и не совпадают с публичными полями. Задача сильно упрощается.

Единственный кейз который я действительно забыл учесть - это наследование, но думаю я сделаю и это

lanwen commented 7 years ago

Супер тогда. с такими ограничениями действительно будет проще. Спасибо