package io.github.lukehutch.fastclasspathscanner.test;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.stream.Collectors;

import org.junit.Test;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
import io.github.lukehutch.fastclasspathscanner.test.whitelisted.ClsSub;
import io.github.lukehutch.fastclasspathscanner.test.whitelisted.ClsSubSub;
import io.github.lukehutch.fastclasspathscanner.test.whitelisted.Iface;
import io.github.lukehutch.fastclasspathscanner.test.whitelisted.IfaceSub;
import io.github.lukehutch.fastclasspathscanner.test.whitelisted.IfaceSubSub;

public class Java8Test {
    @Test
    public void stream() throws Exception {
        final ScanResult scanResult = new FastClasspathScanner().scan();
        assertThat( //
                scanResult.getClassNameToClassInfo().values().stream()
                        .filter(c -> c.getClassName().contains("ClsSub")) //
                        .map(c -> c.getClassName()) //
                        .collect(Collectors.toSet())) //
                                .containsExactly(ClsSub.class.getName(), ClsSubSub.class.getName());
    }

    @Test
    public void streamHasSuperInterface() throws Exception {
        final ScanResult scanResult = new FastClasspathScanner().scan();
        assertThat( //
                scanResult.getClassNameToClassInfo().values().stream() //
                        .filter(c -> c.hasSuperinterface(Iface.class.getName())) //
                        .map(c -> c.getClassName()) //
                        .collect(Collectors.toSet())) //
                                .containsExactly(IfaceSub.class.getName(), IfaceSubSub.class.getName());
    }
}

@@ -107,16 +107,125 @@
 rtThat;%0A
+import static org.assertj.core.api.StrictAssertions.assertThat;%0A%0Aimport java.util.List;%0Aimport java.util.Map;
 %0Aimport 
@@ -348,16 +348,83 @@
 canner;%0A
+import io.github.lukehutch.fastclasspathscanner.scanner.ClassInfo;%0A
 import i
@@ -856,16 +856,88 @@
 eSubSub;
+%0Aimport io.github.lukehutch.fastclasspathscanner.test.whitelisted.Impl1;
 %0A%0Apublic
@@ -2020,11 +2020,466 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void useClassNameToClassInfo() %7B%0A        ScanResult scanResult = new FastClasspathScanner().scan();%0A        Map%3CString, ClassInfo%3E classNameToClassInfo = scanResult.getClassNameToClassInfo();%0A        ClassInfo callableClassInfo = classNameToClassInfo.get(Iface.class.getName());%0A        List%3CString%3E impls = callableClassInfo.getNamesOfClassesImplementing();%0A        assertThat(impls.contains(Impl1.class.getName())).isTrue();%0A    %7D
 %0A%7D%0A

Add test