view src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/AttributesTest.java @ 144:0854f9a9e81d

change attrs form TreeMap<String , ByteBuffer> → TreeMap<String,List<ByteBuffer>>
author one
date Sun, 16 Nov 2014 06:40:48 +0900
parents 7d78bbf4a9cd
children 8a0aa8fc137c
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,List<ByteBuffer>>> ENTRIES = List.list(
		P.p("KEY1",List.list(ByteBuffer.wrap("VALUE1".getBytes()))),
		P.p("KEY2",List.list(ByteBuffer.wrap("VALUE2".getBytes()))),
		P.p("KEY3",List.list(ByteBuffer.wrap("VALUE3".getBytes())))
	);
	
	public abstract Attributes instance();
	
	public void testGet()
	{
		Attributes attrs = instance();
		
		for(P2<String,List<ByteBuffer>> entry : ENTRIES){
			String key = entry._1();
			List<ByteBuffer> expectList = entry._2();
			List<ByteBuffer> actualList = attrs.get(key);
			ByteBuffer expect = expectList.head();
			ByteBuffer actual = actualList.head();
			Assert.assertNotNull(actual);
			Assert.assertEquals(0,actual.compareTo(expect));
		}
	}
}