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_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 ( ) ; } catch ( java.util.InputMismatchException expected ) { } 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 ( ) ; } catch ( java.util.InputMismatchException expected ) { } 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 ( ) ; } catch ( java.util.NoSuchElementException expected ) { } s = new java.util.Scanner ( "word1 WorD2 " ) ; pattern = java.util.regex.Pattern.compile ( "\\w+" ) ; try { s.hasNext ( ( ( java.util.regex.Pattern ) ( null ) ) ) ; fail ( ) ; } catch ( java.lang.NullPointerException expected ) { } s.close ( ) ; try { s.hasNext ( pattern ) ; fail ( ) ; } catch ( java.lang.IllegalStateException expected ) { } 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 ( ) ; } catch ( java.util.InputMismatchException expected ) { } }