View Javadoc
1 2 package org.indy.util; 3 4 import junit.framework.*; 5 import java.io.IOException; 6 7 public class TestIdBuffer extends TestCase { 8 9 IndyBuffer buffer; 10 11 /*** 12 * Constructor for the IdBufferTest object 13 * 14 *@param name The name to give this test 15 */ 16 public TestIdBuffer(String name) { 17 super(name); 18 } 19 20 /*** 21 * The JUnit setup method 22 */ 23 public void setUp() { 24 buffer = new IndyBuffer(); 25 } 26 27 /*** 28 * Runs the JUnit GUI stand alone. 29 * 30 */ 31 public static void main(String[] arg) { 32 junit.swingui.TestRunner.run(TestIdBuffer.class); 33 } 34 35 /*** 36 * The teardown method for JUnit 37 */ 38 public void tearDown() { 39 buffer = null; 40 } 41 42 43 /*** 44 * Tests that {@link IndyBuffer#readLine()} is 45 * repeatable. 46 */ 47 public void testReadLine() { 48 try { 49 buffer.write("A line\nA Second Line\n".getBytes()); 50 assertEquals("Test first line", "A line", buffer.readLine()); 51 assertEquals("Test first line", "A Second Line", buffer.readLine()); 52 buffer.write("A line\n".getBytes()); 53 assertEquals("Test first line", "A line", buffer.readLine()); 54 buffer.write("A Second Line\n".getBytes()); 55 assertEquals("Test first line", "A Second Line", buffer.readLine()); 56 } 57 catch (IOException ioe) { 58 ioe.printStackTrace(); 59 } 60 } 61 }

This page was automatically generated by Maven