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

import java.util.Arrays;
import net.ranides.assira.reflection.IAnnotations;
import net.ranides.test.mockup.reflection.ForIArguments.AboutMethod;
import net.ranides.test.mockup.reflection.ForIArguments.AboutParam;
import net.ranides.assira.reflection.util.AnnotationBuilder;
import org.junit.Test;
import static net.ranides.assira.junit.NewAssert.*;

/**
 *
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
public class AAnnotationsTest {

    @Test
    public void testOf() {
        AboutParam wp = new AnnotationBuilder<>(AboutParam.class)
            .param("name", "hello")
            .param("mode", AboutParam.Mode.INOUT)
            .result();
        AboutMethod wm = new AnnotationBuilder<>(AboutMethod.class)
            .param("action", "open!")
            .param("operationName", "acOpen")
            .result();
        IAnnotations ans = IAnnotations.of(wp,wm);
        
        assertEquivalent(Arrays.asList(wp, wm), ans.list());
        assertEquals(1, ans.require(AboutParam.class).count());
        assertEquals(0, ans.require(Deprecated.class).count());
    }
    
}
