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

import net.ranides.assira.reflection.IAttribute;
import net.ranides.assira.reflection.IClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class WrapperTest {
    
    @Test
    public void testWrapper() {
        Wrapper<String> wrapper = Wrapper.wrap("hello");
        assertEquals("hello", wrapper.get());
        wrapper.set("world");
        assertEquals("world", wrapper.get());
    }
    
    @Test
    public void testType() {
        Wrapper<Number> w1 = Wrapper.wrap(14.1);
        Wrapper<Number> w2 = Wrapper.wrap((Number)14.1);
        Wrapper<String> w3 = Wrapper.wrap("Hello");
        Wrapper<String> w4 = Wrapper.wrap(null);
        
        assertEquals(IClass.typeinfo(Double.class), w1.type());
        assertEquals(IClass.typeinfo(Double.class), w2.type());
        assertEquals(IClass.typeinfo(String.class), w3.type());
        assertEquals(IClass.NULL, w4.type());
    }
}
