Source:
public void test_hasNextLPattern ( ) throws java.io.IOException { java.util.regex.Pattern pattern ; s = new java.util.Scanner ( "aab@2@abb@" ) . useDelimiter ( "\\@" ) ; pattern = java.util.regex.Pattern.compile ( "a*b" ) ; assertTrue ( s.hasNext ( pattern ) ) ; assertEquals ( "aab" , s.next ( pattern ) ) ; assertFalse ( s.hasNext ( pattern ) ) ; try { s.next ( pattern ) ; fail ( "should throw InputMismatchException" ) ; } catch ( java.util.InputMismatchException e ) { } s = new java.util.Scanner ( "word ? " ) ; pattern = java.util.regex.Pattern.compile ( "\\w+" ) ; assertTrue ( s.hasNext ( pattern ) ) ; assertEquals ( "word" , s.next ( pattern ) ) ; assertFalse ( s.hasNext ( pattern ) ) ; try { s.next ( pattern ) ; fail ( "should throw InputMismatchException" ) ; } catch ( java.util.InputMismatchException e ) { } s = new java.util.Scanner ( "word1 WorD2 " ) ; pattern = java.util.regex.Pattern.compile ( "\\w+" ) ; assertTrue ( s.hasNext ( pattern ) ) ; assertEquals ( "word1" , s.next ( pattern ) ) ; assertTrue ( s.hasNext ( pattern ) ) ; assertEquals ( "WorD2" , s.next ( pattern ) ) ; assertFalse ( s.hasNext ( pattern ) ) ; try { s.next ( pattern ) ; fail ( "should throw NoSuchElementException" ) ; } catch ( java.util.NoSuchElementException e ) { } s = new java.util.Scanner ( "word1 WorD2 " ) ; pattern = java.util.regex.Pattern.compile ( "\\w+" ) ; try { s.hasNext ( ( ( java.util.regex.Pattern ) ( null ) ) ) ; fail ( "Should throw NullPointerException" ) ; } catch ( java.lang.NullPointerException e ) { } s.close ( ) ; try { s.hasNext ( pattern ) ; fail ( "should throw IllegalStateException" ) ; } catch ( java.lang.IllegalStateException e ) { } os.write ( "aab b" . getBytes ( ) ) ; serverSocket.close ( ) ; s = new java.util.Scanner ( client ) ; pattern = java.util.regex.Pattern.compile ( "a+b" ) ; assertTrue ( s.hasNext ( pattern ) ) ; assertEquals ( "aab" , s.next ( pattern ) ) ; assertFalse ( s.hasNext ( pattern ) ) ; try { s.next ( pattern ) ; fail ( "should throw InputMismatchException" ) ; } catch ( java.util.InputMismatchException e ) { } }

Target:
public void test_hasNextLString ( ) throws java.io.IOException { s = new java.util.Scanner ( "aab@2@abb@" ) . useDelimiter ( "\\@" ) ; try { s.hasNext ( ( ( java.lang.String ) ( null ) ) ) ; fail ( ) ; } catch ( java.lang.NullPointerException expected ) { } s = new java.util.Scanner ( "aab*b*" ) . useDelimiter ( "\\*" ) ; assertTrue ( s.hasNext ( "a+b" ) ) ; assertEquals ( "aab" , s.next ( "a+b" ) ) ; assertFalse ( s.hasNext ( "a+b" ) ) ; try { s.next ( "a+b" ) ; fail ( ) ; } catch ( java.util.InputMismatchException expected ) { } s.close ( ) ; try { s.hasNext ( "a+b" ) ; fail ( ) ; } catch ( java.lang.IllegalStateException expected ) { } s = new java.util.Scanner ( "WORD ? " ) ; assertTrue ( s.hasNext ( "\\w+" ) ) ; assertEquals ( "WORD" , s.next ( "\\w+" ) ) ; assertFalse ( s.hasNext ( "\\w+" ) ) ; try { s.next ( "\\w+" ) ; fail ( ) ; } catch ( java.util.InputMismatchException expected ) { } s = new java.util.Scanner ( "word1 word2 " ) ; assertEquals ( "word1" , s.next ( "\\w+" ) ) ; assertEquals ( "word2" , s.next ( "\\w+" ) ) ; try { s.next ( "\\w+" ) ; fail ( ) ; } catch ( java.util.NoSuchElementException expected ) { } os.write ( "aab 2" . getBytes ( ) ) ; serverSocket.close ( ) ; s = new java.util.Scanner ( client ) ; assertTrue ( s.hasNext ( "a*b" ) ) ; assertEquals ( "aab" , s.next ( "a*b" ) ) ; assertFalse ( s.hasNext ( "a*b" ) ) ; try { s.next ( "a*b" ) ; fail ( ) ; } catch ( java.util.InputMismatchException expected ) { } }