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

import net.ranides.assira.junit.TestResource;
import net.ranides.assira.collection.maps.LazyMap;
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 LazyMapTester<K,V> {
        
    @TestResource(name = "map!")
    private TMap<K,V> $var;
    
    @TestResource(name = "map.default!")
    private V $default = null;
    
    @TestContract
    public void basicIfPresent(LazyMap<K, V> target) {
        
        $var.item(14).into(target);
        
        assertEquals($var.item(14).value(), target.getIfPresent($var.item(14).key()));
        assertEquals($var.item(14).value(), target.get($var.item(14).key()));

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