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

import net.ranides.assira.text.StringUtils;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;

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

    public StackInspectorTest() {
    }

    @Ignore("verbose")
    @Test
    public void testLocalStack() {
        LoggerUtils.dump("invoke = %s\n", StackInspector.frame(0) );
        LoggerUtils.dump("callee = %s\n", StackInspector.frame(StackInspector.CALLEE) );
        LoggerUtils.dump("caller = %s\n", StackInspector.frame(StackInspector.CALLER) );

        LoggerUtils.dump("\n");
        LoggerUtils.dump("invoke = %s\n", StackInspector.frameClass(0) );
        LoggerUtils.dump("callee = %s\n", StackInspector.frameClass(StackInspector.CALLEE) );
        LoggerUtils.dump("caller = %s\n", StackInspector.frameClass(StackInspector.CALLER) );

        LoggerUtils.dump("\n");
        LoggerUtils.dump("invoke = %s\n", StackInspector.frameFile(0) );
        LoggerUtils.dump("callee = %s\n", StackInspector.frameFile(StackInspector.CALLEE) );
        LoggerUtils.dump("caller = %s\n", StackInspector.frameFile(StackInspector.CALLER) );

        LoggerUtils.dump("\nchain:\n - %s\n",
            StringUtils.join(StackInspector.getFrames().classes(), "\n - ")
        );
        LoggerUtils.dump("\njunit:\n - %s\n",
            StringUtils.join( StackInspector.getCallers().selectClassName("org.junit.runners.").classes(), "\n - ")
        );
        LoggerUtils.dump("\napache:\n - %s\n",
            StringUtils.join( StackInspector.getCallers().selectClassName("org.apache.").classes(), "\n - ")
        );

        assertTrue(true);
    }
 
}
