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

import net.ranides.assira.junit.TestResource;
import net.ranides.assira.collection.maps.IntLazyMap;
import net.ranides.test.data.TMap;
import static net.ranides.assira.junit.NewAssert.*;
import net.ranides.assira.junit.TestContract;

/**
 *
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
@SuppressWarnings("element-type-mismatch")
public final class IntLazyMapTester<K,V> {
        
    @TestResource(name = "map!")
    private TMap<Integer,V> $var;
    
    @TestResource(name = "map.default!")
    private V $default = null;
    
    @TestContract
    public void basicIfPresent(IntLazyMap<V> target) {
        
        $var.item(14).into(target);
        
        assertEquals($var.item(14).value(), target.getIfPresent($var.item(14).keyInt()));
        assertEquals($var.item(14).value(), target.get($var.item(14).keyInt()));

        assertEquals(null, target.getIfPresent($var.item(15).keyInt()));
        
        assertEquals($default, target.get($var.item(16).keyInt()));
    }
        
}
