view src/test/java/jp/ac/u_ryukyu/ie/cr/jungle/core/AttributesTest.java @ 0:44465893e8b8

first Commit
author Kazuma
date Wed, 30 Nov 2016 01:47:55 +0900
parents
children
line wrap: on
line source

package jp.ac.u_ryukyu.ie.cr.jungle.core;

import jp.ac.u_ryukyu.ie.cr.jungle.util.Pair;
import jp.ac.u_ryukyu.ie.cr.jungle.data.list.List;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Ignore;

import java.nio.ByteBuffer;

@Ignore
public abstract class AttributesTest extends TestCase {
    @SuppressWarnings("unchecked")
    public static List<Pair<String, ByteBuffer>> ENTRIES = new List(
            new Pair("KEY1", ByteBuffer.wrap("VALUE1".getBytes())),
            new Pair("KEY2", ByteBuffer.wrap("VALUE2".getBytes())),
            new Pair("KEY3", ByteBuffer.wrap("VALUE3".getBytes()))
    );

    public abstract Attributes instance();

    public void testGet() {
        Attributes attrs = instance();

        for (Pair<String, ByteBuffer> entry : ENTRIES) {
            String key = entry.left();
            ByteBuffer expect = entry.right();
            ByteBuffer actual = attrs.get(key);
            Assert.assertNotNull(actual);
            Assert.assertEquals(0, actual.compareTo(expect));
        }
    }
}