package com.tvd12.ezyfox.testing.reflect;

import com.tvd12.ezyfox.reflect.EzyClassTree;
import org.testng.annotations.Test;

import java.util.stream.Collectors;

public class EzyClassTreeTest {

    @Test
    public void test() {
        EzyClassTree tree = new EzyClassTree(Ex2Branch2Exception.class);
        tree.add(Ex2Branch2Exception.class);
        tree.add(Ex2Branch1Exception.class);
        tree.add(Ex1Branch2Exception.class);
        tree.add(Ex1Branch1Exception.class);
        tree.add(Branch2Exception.class);
        tree.add(Branch1Exception.class);
        tree.add(Exception.class);
        tree.add(RootException.class);
        tree.add(RootException.class);
        System.out.println(tree);

        System.out.println("\n================================");
        System.out.println(tree.toList().stream()
            .map(Class::toString)
            .collect(Collectors.joining("\n")));
    }

    public static class Ex2Branch2Exception extends Branch2Exception {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class Ex1Branch2Exception extends Branch2Exception {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class Ex2Branch1Exception extends Branch1Exception {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class Ex1Branch1Exception extends Branch1Exception {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class Branch2Exception extends RootException {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class Branch1Exception extends RootException {
        private static final long serialVersionUID = -6068208036555261492L;
    }

    public static class RootException extends Exception {
        private static final long serialVersionUID = -6068208036555261492L;
    }
}

@@ -82,16 +82,57 @@
 ssTree;%0A
+import com.tvd12.test.assertion.Asserts;%0A
 import o
@@ -156,24 +156,47 @@
 ions.Test;%0A%0A
+import java.util.List;%0A
 import java.
@@ -971,32 +971,269 @@
 %22%5Cn%22)));%0A    %7D%0A%0A
+    @Test%0A    public void defaultConstructor() %7B%0A        // given%0A        EzyClassTree sut = new EzyClassTree();%0A%0A        // when%0A        List%3CClass%3C?%3E%3E actual = sut.toList();%0A%0A        // then%0A        Asserts.assertEmpty(actual);%0A    %7D%0A%0A
     public stati

update unit test