Code example for Scanner

Methods: closefindInLine

0
 
    /** 
     * @tests java.util.Scanner#findInLine(String) 
     */ 
    public void test_findInLine_LString() { 
        s = new Scanner("test");
        try { 
            s.findInLine((String) null);
            fail("Should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected 
        } 
 
        s.close();
        try { 
            s.findInLine((String) null);
            fail("Should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected 
        } 
        try { 
            s.findInLine("test");
            fail("Should throw IllegalStateException");
        } catch (IllegalStateException e) {
            // exptected 
        } 
    }