Code example for LineNumberReader

Methods: getLineNumber, readLine

0
 
    /** 
     * @tests java.io.LineNumberReader#getLineNumber() 
     */ 
    public void test_getLineNumber() throws IOException { 
        lnr = new LineNumberReader(new StringReader(text));
        assertEquals("Returned incorrect line number--expected 0, got ", 0, lnr
                .getLineNumber());
 
        lnr.readLine();
        lnr.readLine();
 
        assertTrue("Returned incorrect line number--expected 2, got: "
                + lnr.getLineNumber(), lnr.getLineNumber() == 2);
    } 
 
    /** 
     * @tests java.io.LineNumberReader#mark(int) 
     */ 
    public void test_markI() throws IOException { 
        lnr = new LineNumberReader(new StringReader(text));