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

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Type;
import java.util.ArrayList;
import net.ranides.assira.reflection.IClass;
import static net.ranides.assira.junit.NewAssert.*;
import org.junit.Test;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class RPClassTest {
    
    @Test
    @SuppressFBWarnings("DM_NEW_FOR_GETCLASS")
    public void testSomeMethod() {
        Type type0 = new Hello<Float>().new Items().getClass().getGenericSuperclass();
        Type type1 = new Hello<Float>().new Items(){}.getClass().getGenericSuperclass();

        assertEquals("java.util.ArrayList<T>", IClass.typeinfo(type0).toString());
        assertEquals(IClass.NULL, IClass.typeinfo(type0).outer());
        
        assertEquals("net.ranides.assira.reflection.impl.RPClassTest$Hello$Items", IClass.typeinfo(type1).toString());
        assertEquals("net.ranides.assira.reflection.impl.RPClassTest$Hello<java.lang.Float>", IClass.typeinfo(type1).outer().toString());
    }
    
    private static final class Hello<T> {
        
        private class Items extends ArrayList<T> {
            
        }
        
    }
    
}
