@ Override public ParseResult parse ( Source source ) { if ( ! testSrcInfo . equals ( source . getSrcInfo ( ) ) ) { throw new RuntimeException ( "testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source . getSrcInfo ( ) ) ; } try { BufferedReader reader = source . createReader ( ) ; try { if ( ! testString . equals ( reader . readLine ( ) ) ) { throw new RuntimeException ( "testString and reader.readLine() were not equal" ) ; } final String secondLine = reader . readLine ( ) ; if ( secondLine != null ) { throw new RuntimeException ( "got a second line '" + secondLine + "' from the reader" ) ; } } finally { reader . close ( ) ; } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } return testResult ; }
When called this examines the source to make sure the scrcInfo and data are the expected testSrcInfo and testString . It then produces the testDoc as a result