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

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;

import net.ranides.assira.reflection.IClass;
import net.ranides.assira.reflection.mockup.ForBeanModel;
import org.junit.Test;

import static net.ranides.assira.junit.NewAssert.*;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class CDParametersTest {
    
    public CDParametersTest() {
    }

    @Test
    public void testSomeMethod() throws IOException {
        IClass<?> ic = IClass.typeinfo(ForBeanModel.class);
        AtomicBoolean connect = new AtomicBoolean();

        ic.methods().each(m -> {
            String[] names = CDParameters.getParams(m.reflective());
            if(null == names) {
                if("void net.ranides.assira.reflection.mockup.ForBeanModel.connect()".equals(m.toString())) {
                    connect.set(true);
                    return;
                }
                assertEquals(IClass.OBJECT, m.parent());
            }
        });
        assertTrue(connect.get());
    }
    
}
