1 package org.sapia.util.cursor.impl; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import junit.framework.TestCase; 7 8 17 public class ListCursorFeedTest extends TestCase{ 18 19 public ListCursorFeedTest(String name){ 20 super(name); 21 } 22 23 public void testRead() throws Exception { 24 Object [] buffer = new Object [4]; 25 List items = new ArrayList (); 26 for(int i = 1; i <= 12; i++){ 27 items.add(""+i); 28 } 29 ListCursorFeed feed = new ListCursorFeed(items); 30 int total = 1; 31 for(int i = 1; i <= 3; i++){ 32 int count = feed.read(buffer); 33 super.assertEquals(4, count); 34 for(int j = 0; j < count; j++, total++){ 35 super.assertEquals(""+total, buffer[j]); 36 } 37 } 38 super.assertEquals(0, feed.read(buffer)); 39 } 40 } 41 | Popular Tags |