/*
 * @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.util.Arrays;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import net.ranides.assira.reflection.IAnnotations;
import net.ranides.assira.reflection.util.AnnotationBuilder;
import org.junit.Test;
import static net.ranides.assira.junit.NewAssert.*;

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

    @Test
    public void testOf() {
        WebParam wp = new AnnotationBuilder<>(WebParam.class)
            .param("name", "hello")
            .param("mode", WebParam.Mode.INOUT)
            .result();
        WebMethod wm = new AnnotationBuilder<>(WebMethod.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(WebParam.class).count());
        assertEquals(0, ans.require(Deprecated.class).count());
    }
    
}
