package net.ranides.assira.collection.maps;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.*;

public class TagTest {

    @Test
    public void testWithMap() {
        Tag<String, Integer> key1 = new Tag<>(Integer.class, "int");
        Tag<String, Float> key2 = new Tag<>(Float.class, "float");

        Map<String, Object> map = new HashMap<>();
        key1.put(map, 14);
        key2.put(map, 14.5f);

        assertEquals(14, map.get("int"));
        assertEquals(14.5f, (Float)map.get("float"), 0.1f);

        assertEquals((Integer)14, key1.get(map));
        assertEquals(14.5f, key2.get(map), 0.1f);
    }
}