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

import static net.ranides.assira.reflection.IAttribute.*;
import org.junit.Test;
import net.ranides.assira.reflection.IHints;
import static net.ranides.assira.junit.NewAssert.*;

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

    @Test
    public void testEquals() {
        IHints h1 = FElements.newHints();
        IHints h2 = FElements.newHints();
        IHints h3 = FElements.newHints();
        h1.require(collect(PUBLIC, FINAL));
        h2.require(collect(PUBLIC, FINAL));
        h3.require(collect(BRIDGE));
        h3.discard(collect(PUBLIC, NATIVE));
        
        assertEquality(h1,h2,h3);
        assertEquality(h1,h2,"");
        
        assertEquals("AHints{require=[PUBLIC, FINAL], discard=[]}", h1.toString());
        assertEquals("AHints{require=[PUBLIC, FINAL], discard=[]}", h2.toString());
        assertEquals("AHints{require=[BRIDGE], discard=[PUBLIC, NATIVE]}", h3.toString());
    }
    
    @Test
    public void testRmpty() {
        IHints none = AHints.EMPTY;
        none.require(collect(BRIDGE));
        none.discard(collect(PUBLIC, NATIVE));
        
        assertEquals("AHints{require=[], discard=[]}", none.toString());

        IHints h3 = FElements.newHints();
        h3.require(collect(BRIDGE));
        h3.discard(collect(PUBLIC, NATIVE));
        none.replace(h3);
        assertEquals("AHints{require=[], discard=[]}", none.toString());
    }
    
}
