/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.reflection.inspect;

import java.util.Collection;
import net.ranides.assira.reflection.mock.ForMemberUtils;
import net.ranides.assira.reflection.mock.StrictFP;
import net.ranides.assira.system.RuntimeUtils;
import net.ranides.assira.trace.LoggerUtils;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Ignore;

/**
 *
 * @author ranides
 */
public class PackageInspectorTest {

    public PackageInspectorTest() {
        LoggerUtils.initTest();
    }

    @Ignore("manual")
    @Test
    public void testScanManual() throws Exception {
        if( !RuntimeUtils.invokedInsideSingleTest() ) {
            return;
        }
        int i = 1;
        for(Class<?> clazz : PackageInspector.scan("net.ranides")) {
            LoggerUtils.dump("   - %d. %s\n", i++, clazz);
        }

        LoggerUtils.dump("count = %d \n", PackageInspector.scan("net.ranides").size() );

        LoggerUtils.dump("count = %d \n", PackageInspector.scan("net.ranides.assira").size() );

        LoggerUtils.dump("count = %d \n", PackageInspector.scan("net.ranides.assira.collection").size() );

        LoggerUtils.dump("count = %d \n", PackageInspector.scan("net.ranides.assira.collection.map").size() );

        assertTrue(true);
    }
    
    @Test
    public void testScan() throws Exception {
        Collection<Class<?>> list = PackageInspector.scan("net.ranides.assira.reflection.mock");
        
        assertTrue(list.size() > 10);
        assertTrue(list.contains(StrictFP.class));
        assertTrue(list.contains(StrictFP.Strict1.class));
        assertTrue(list.contains(ForMemberUtils.class));
        
        assertTrue(list.contains(ForMemberUtils.PRIVATE));
        assertTrue(list.contains(ForMemberUtils.INTERFACE));
        assertTrue(list.contains(ForMemberUtils.ABSTRACT));
    }
}