view src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/AttributesTest.java @ 152:8a0aa8fc137c

Merge with a2c374a2686b82b0ad30f520412e191b84288fa9
author one
date Sat, 22 Nov 2014 15:25:09 +0900
parents 0854f9a9e81d
children
line wrap: on
line source

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

import org.junit.Ignore;
import java.nio.ByteBuffer;
import fj.P2;
import fj.P;
import fj.data.List;
import junit.framework.Assert;
import junit.framework.TestCase;

@Ignore
public abstract class AttributesTest extends TestCase
{
	@SuppressWarnings("unchecked")
	public static List<P2<String,ByteBuffer>> ENTRIES = List.list(
		P.p("KEY1",ByteBuffer.wrap("VALUE1".getBytes())),
		P.p("KEY2",ByteBuffer.wrap("VALUE2".getBytes())),
		P.p("KEY3",ByteBuffer.wrap("VALUE3".getBytes()))
	);
	
	public abstract Attributes instance();
	
	public void testGet()
	{
		Attributes attrs = instance();
		
		for(P2<String,ByteBuffer> entry : ENTRIES){
			String key = entry._1();
			ByteBuffer expect = entry._2();
			ByteBuffer actual = attrs.get(key);
			Assert.assertNotNull(actual);
			Assert.assertEquals(0,actual.compareTo(expect));
		}
	}
}