@Test public void testConsumeUpdate() throws IOException { List<File> extractedFiles = new ArrayList<File>(); StreamConsumer consumer = new FileConsumer( extractedFiles, FileConsumer.UPDATE_PATTERN ); consumer.consumeLine( "Content (1 K) of \"readme.txt\" - ok" ); consumer.consumeLine( "Creating dir \"src/main/java/org\" ." ); consumer.consumeLine( "Updating (creating) dir /./src/test/java" ); consumer.consumeLine( "Updating element \\.\\src\\main\\java\\Application.java" ); assertThat( extractedFiles.size(), is( 2 ) ); assertThat( extractedFiles, hasItem( new File( "readme.txt" ) ) ); assertThat( extractedFiles, hasItem( new File( "src\\main\\java\\Application.java" ) ) ); }
public void consumeLine( String line ) { Matcher m = filePattern.matcher( line ); if ( m.matches() ) { int i = 1; String fileName = null; while ( fileName == null && i <= m.groupCount() ) { fileName = m.group( i++ ); } if ( fileName != null ) { matchedFiles.add( new File( fileName ) ); } } }
FileConsumer implements StreamConsumer { public void consumeLine( String line ) { Matcher m = filePattern.matcher( line ); if ( m.matches() ) { int i = 1; String fileName = null; while ( fileName == null && i <= m.groupCount() ) { fileName = m.group( i++ ); } if ( fileName != null ) { matchedFiles.add( new File( fileName ) ); } } } }
FileConsumer implements StreamConsumer { public void consumeLine( String line ) { Matcher m = filePattern.matcher( line ); if ( m.matches() ) { int i = 1; String fileName = null; while ( fileName == null && i <= m.groupCount() ) { fileName = m.group( i++ ); } if ( fileName != null ) { matchedFiles.add( new File( fileName ) ); } } } FileConsumer( List<File> matchedFilesAccumulator, Pattern filematcher ); }
FileConsumer implements StreamConsumer { public void consumeLine( String line ) { Matcher m = filePattern.matcher( line ); if ( m.matches() ) { int i = 1; String fileName = null; while ( fileName == null && i <= m.groupCount() ) { fileName = m.group( i++ ); } if ( fileName != null ) { matchedFiles.add( new File( fileName ) ); } } } FileConsumer( List<File> matchedFilesAccumulator, Pattern filematcher ); void consumeLine( String line ); }
FileConsumer implements StreamConsumer { public void consumeLine( String line ) { Matcher m = filePattern.matcher( line ); if ( m.matches() ) { int i = 1; String fileName = null; while ( fileName == null && i <= m.groupCount() ) { fileName = m.group( i++ ); } if ( fileName != null ) { matchedFiles.add( new File( fileName ) ); } } } FileConsumer( List<File> matchedFilesAccumulator, Pattern filematcher ); void consumeLine( String line ); static final Pattern ADD_PATTERN; static final Pattern UPDATE_PATTERN; static final Pattern POPULATE_PATTERN; static final Pattern PROMOTE_PATTERN; static final Pattern STAT_PATTERN; static final Pattern DEFUNCT_PATTERN; }