// Path: feature-matcher-generator/src/test/java/ru/yandex/qatools/processors/matcher/gen/testclasses/Outer.java
// public class Outer {
//     public static class Nested {
//         public static class TwiceNested {
//             private int field;
//         }
//     }
// }
// 
// Path: feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/elements/ElementParentsIterable.java
// public static Stream<Element> stream(Element element) {
//     return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
// }
// 
// Path: feature-matcher-generator/src/test/java/ru/yandex/qatools/processors/matcher/gen/processing/MethodsCollectorTest.java
// public static Predicate<Element> ofKind(ElementKind kind) {
//     return elem -> elem.getKind() == kind;
// }


import com.google.testing.compile.CompilationRule;
import org.junit.Rule;
import org.junit.Test;
import ru.yandex.qatools.processors.matcher.gen.testclasses.Outer;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static ru.yandex.qatools.processors.matcher.gen.elements.ElementParentsIterable.stream;
import static ru.yandex.qatools.processors.matcher.gen.processing.MethodsCollectorTest.ofKind;
package ru.yandex.qatools.processors.matcher.gen.elements;




/**
 * @author lanwen (Merkushev Kirill)
 */
public class ElementParentsIterableTest {

    @Rule
    public CompilationRule compilation = new CompilationRule();

    @Test
    public void shouldGetParents() throws Exception {
        TypeElement twiceNested = compilation.getElements()
                .getTypeElement(Outer.Nested.TwiceNested.class.getCanonicalName());
        List<? extends Element> members = compilation.getElements().getAllMembers(twiceNested);

// Path: feature-matcher-generator/src/test/java/ru/yandex/qatools/processors/matcher/gen/testclasses/Outer.java
// public class Outer {
//     public static class Nested {
//         public static class TwiceNested {
//             private int field;
//         }
//     }
// }
// 
// Path: feature-matcher-generator/src/main/java/ru/yandex/qatools/processors/matcher/gen/elements/ElementParentsIterable.java
// public static Stream<Element> stream(Element element) {
//     return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
// }
// 
// Path: feature-matcher-generator/src/test/java/ru/yandex/qatools/processors/matcher/gen/processing/MethodsCollectorTest.java
// public static Predicate<Element> ofKind(ElementKind kind) {
//     return elem -> elem.getKind() == kind;
// }


// Path: feature-matcher-generator/src/test/java/ru/yandex/qatools/processors/matcher/gen/elements/ElementParentsIterableTest.java
import com.google.testing.compile.CompilationRule;
import org.junit.Rule;
import org.junit.Test;
import ru.yandex.qatools.processors.matcher.gen.testclasses.Outer;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static ru.yandex.qatools.processors.matcher.gen.elements.ElementParentsIterable.stream;
import static ru.yandex.qatools.processors.matcher.gen.processing.MethodsCollectorTest.ofKind;

package ru.yandex.qatools.processors.matcher.gen.elements;




/**
 * @author lanwen (Merkushev Kirill)
 */
public class ElementParentsIterableTest {

    @Rule
    public CompilationRule compilation = new CompilationRule();

    @Test
    public void shouldGetParents() throws Exception {
        TypeElement twiceNested = compilation.getElements()
                .getTypeElement(Outer.Nested.TwiceNested.class.getCanonicalName());
        List<? extends Element> members = compilation.getElements().getAllMembers(twiceNested);

        Element field = members.stream().filter(ofKind(ElementKind.FIELD)).findFirst()