Code example for LineNumberReader

Methods: getLineNumberreadLine

0
        assertEquals("world", lnr.readLine());
        assertEquals(2, lnr.getLineNumber());
    } 
 
    public void testGetLineNumberAfterEnd() throws IOException { 
        lnr = new LineNumberReader(new StringReader("hello\nworld"));
        assertEquals(0, lnr.getLineNumber());
        assertEquals("hello", lnr.readLine());
        assertEquals(1, lnr.getLineNumber());
        assertEquals("world", lnr.readLine());
        assertEquals(2, lnr.getLineNumber());
        assertEquals(null, lnr.readLine());
        assertEquals(2, lnr.getLineNumber());
        assertEquals(null, lnr.readLine());
        assertEquals(2, lnr.getLineNumber());
    } 
 
    /** 
     * @tests java.io.LineNumberReader#setLineNumber(int) 
     */ 
Stop searching for code, let great code find you!  Add Codota to your java IDE