Code example for LineNumberInputStream

Methods: getLineNumbersetLineNumber

            // Expected. 
    public void test_setLineNumberI() { 
        assertEquals("Test 1: Failed to set line number;",
                42, lnis.getLineNumber());
        // Repeat the test with a different number to make sure that the 
        // line number is really set. 
        assertEquals("Test 2: Failed to set line number;",
                89, lnis.getLineNumber());
    public void test_skipJ() throws IOException { 
        long skipped = lnis.skip(4);
        assertEquals("Test 1: Incorrect number of characters skipped;",
                4, skipped);
        assertEquals("Test 2: Skip failed to increment line number;",
Experience pair programming with AI  Get Codota for Java