This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch SCM-891
in repository https://gitbox.apache.org/repos/asf/maven-scm.git

commit 3febd03186ec5ad5b27bba20f97ce8326d7ad748
Author: Davide Angelocola <davide.angeloc...@gmail.com>
AuthorDate: Wed Aug 1 22:10:19 2018 +0200

    [SCM-891] Remove duplicate code in tests
    
    This closes #82
---
 .../org/apache/maven/scm/util/ConsumerUtils.java   | 63 ++++++++++++++++++++++
 .../changelog/BazaarChangeLogConsumerTest.java     | 13 +----
 .../command/add/PerforceAddConsumerTest.java       | 13 +----
 .../command/blame/PerforceBlameConsumerTest.java   | 10 +---
 .../command/blame/PerforceFilelogConsumerTest.java | 10 +---
 .../changelog/PerforceChangeLogConsumerTest.java   | 13 +----
 .../changelog/PerforceDescribeConsumerTest.java    | 13 +----
 .../checkin/PerforceCheckInConsumerTest.java       | 31 ++---------
 .../checkout/PerforceCheckOutConsumerTest.java     | 22 ++------
 .../command/diff/PerforceDiffConsumerTest.java     | 13 +----
 .../command/edit/PerforceEditConsumerTest.java     | 13 +----
 .../command/login/PerforceLoginConsumerTest.java   | 22 ++------
 .../command/remove/PerforceRemoveConsumerTest.java | 13 +----
 .../command/status/PerforceStatusConsumerTest.java | 13 +----
 .../command/tag/PerforceTagConsumerTest.java       | 22 ++------
 .../command/unedit/PerforceUnEditConsumerTest.java | 22 ++------
 .../changelog/StarteamChangeLogConsumerTest.java   | 17 +-----
 .../command/diff/StarteamDiffConsumerTest.java     | 17 +-----
 .../command/status/StarteamStatusConsumerTest.java | 17 +-----
 .../tfs/command/blame/TfsBlameConsumerTest.java    | 13 +----
 .../changelog/CvsChangeLogConsumerTest.java        | 14 +----
 .../git/command/diff/GitDiffConsumerTest.java      | 32 ++---------
 .../gitexe/command/blame/GitBlameConsumerTest.java | 15 ++----
 .../changelog/GitChangeLogConsumerTest.java        | 23 ++------
 .../command/remove/GitRemoveConsumerTest.java      | 21 ++------
 .../changelog/SvnChangeLogConsumerTest.java        | 30 ++---------
 26 files changed, 129 insertions(+), 376 deletions(-)

diff --git 
a/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java 
b/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java
new file mode 100644
index 0000000..bed2189
--- /dev/null
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/util/ConsumerUtils.java
@@ -0,0 +1,63 @@
+package org.apache.maven.scm.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
+/**
+ * @author <a href="mailto:davide.angelocola+apa...@gmail.com";>Davide 
Angelocola</a>
+ */
+public class ConsumerUtils
+{
+
+    private ConsumerUtils()
+    {
+    }
+
+    /**
+     * Read file f, sending each line to the consumer.
+     *
+     * @param f
+     * @param consumer
+     * @throws IOException
+     */
+    public static void consumeFile(File f, StreamConsumer consumer) throws 
IOException
+    {
+        BufferedReader r = new BufferedReader( new FileReader( f ) );
+
+        try
+        {
+            String line;
+            while ( ( line = r.readLine() ) != null )
+            {
+                consumer.consumeLine( line );
+            }
+
+        } finally
+        {
+            r.close();
+        }
+    }
+}
diff --git 
a/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
index 366c1a2..f13cf20 100644
--- 
a/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java
@@ -19,11 +19,8 @@ package 
org.apache.maven.scm.provider.bazaar.command.changelog;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ChangeFile;
@@ -31,6 +28,7 @@ import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.junit.Assert;
 
 public class BazaarChangeLogConsumerTest
@@ -43,14 +41,7 @@ public class BazaarChangeLogConsumerTest
 
         BazaarChangeLogConsumer consumer = new BazaarChangeLogConsumer( new 
DefaultLog(), null );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ChangeSet> mods = consumer.getModifications();
         assertEquals( 4, mods.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
index 6ac5e6f..f0ca223 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/add/PerforceAddConsumerTest.java
@@ -19,14 +19,12 @@ package org.apache.maven.scm.provider.perforce.command.add;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,14 +40,7 @@ public class PerforceAddConsumerTest
 
         PerforceAddConsumer consumer = new PerforceAddConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ScmFile> adds = consumer.getAdditions();
         assertEquals( "Wrong number of entries returned", 3, adds.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
index 9c3fda4..64d4103 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceBlameConsumerTest.java
@@ -23,6 +23,7 @@ import junit.framework.Assert;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 import java.io.*;
 
@@ -40,14 +41,7 @@ public class PerforceBlameConsumerTest
 
         PerforceBlameConsumer consumer = new PerforceBlameConsumer( new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Assert.assertEquals( 2, consumer.getLines().size() );
 
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
index 78a53d3..46ea345 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/blame/PerforceFilelogConsumerTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.scm.provider.perforce.command.blame;
 import junit.framework.Assert;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 import java.io.*;
 
@@ -39,14 +40,7 @@ public class PerforceFilelogConsumerTest
 
         PerforceFilelogConsumer consumer = new PerforceFilelogConsumer( new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Assert.assertEquals( "earl", consumer.getAuthor( "35" ) );
         Assert.assertEquals( "raj", consumer.getAuthor( "34" ) );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
index b26bd97..719dcc0 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceChangeLogConsumerTest.java
@@ -19,15 +19,13 @@ package 
org.apache.maven.scm.provider.perforce.command.changelog;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -44,14 +42,7 @@ public class PerforceChangeLogConsumerTest
         PerforceChangesConsumer consumer =
             new PerforceChangesConsumer( new DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<String> entries = new ArrayList<String>( consumer.getChanges() );
         assertEquals( "Wrong number of entries returned", 7, entries.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
index 1606418..dae29af 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/changelog/PerforceDescribeConsumerTest.java
@@ -19,10 +19,7 @@ package 
org.apache.maven.scm.provider.perforce.command.changelog;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -30,6 +27,7 @@ import org.apache.maven.scm.ChangeFile;
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -46,14 +44,7 @@ public class PerforceDescribeConsumerTest
         PerforceDescribeConsumer consumer =
             new PerforceDescribeConsumer( "//depot/test", null, new 
DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ChangeSet> entries = new ArrayList<ChangeSet>( 
consumer.getModifications() );
         assertEquals( "Wrong number of entries returned", 7, entries.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
index 79e9868..22618a9 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkin/PerforceCheckInConsumerTest.java
@@ -20,11 +20,9 @@ package 
org.apache.maven.scm.provider.perforce.command.checkin;
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -40,14 +38,7 @@ public class PerforceCheckInConsumerTest
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
@@ -60,14 +51,7 @@ public class PerforceCheckInConsumerTest
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
@@ -80,14 +64,7 @@ public class PerforceCheckInConsumerTest
 
         PerforceCheckInConsumer consumer = new PerforceCheckInConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.getOutput(), consumer.isSuccess() );
         assertTrue( consumer.getOutput(), consumer.getOutput().length() > 0 );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
index d1b2638..22dceba 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/checkout/PerforceCheckOutConsumerTest.java
@@ -22,11 +22,9 @@ package 
org.apache.maven.scm.provider.perforce.command.checkout;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -45,14 +43,7 @@ public class PerforceCheckOutConsumerTest
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.getOutput(), consumer.isSuccess() );
         assertEquals( "", consumer.getOutput() );
@@ -75,14 +66,7 @@ public class PerforceCheckOutConsumerTest
         consumer.consumeLine( "Client test-test-maven saved." );
         assertTrue( consumer.isSuccess() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.getOutput(), consumer.isSuccess() );
         assertTrue( consumer.getOutput(), consumer.getOutput().length() > 0 );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
index 559def9..e7998e1 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/diff/PerforceDiffConsumerTest.java
@@ -20,11 +20,9 @@ package org.apache.maven.scm.provider.perforce.command.diff;
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -40,14 +38,7 @@ public class PerforceDiffConsumerTest
 
         PerforceDiffConsumer consumer = new PerforceDiffConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         // Linebreak differences will fail if we try to assert
         // the exact file length so we just use a rough approximation.
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
index c7a07c7..4aa850c 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/edit/PerforceEditConsumerTest.java
@@ -19,14 +19,12 @@ package org.apache.maven.scm.provider.perforce.command.edit;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,14 +40,7 @@ public class PerforceEditConsumerTest
 
         PerforceEditConsumer consumer = new PerforceEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ScmFile> edits = consumer.getEdits();
         assertEquals( "Wrong number of entries returned", 2, edits.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
index 02def2a..291dfa6 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/login/PerforceLoginConsumerTest.java
@@ -20,11 +20,9 @@ package org.apache.maven.scm.provider.perforce.command.login;
  */
 
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -39,14 +37,7 @@ public class PerforceLoginConsumerTest
 
         PerforceLoginConsumer consumer = new PerforceLoginConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
@@ -59,14 +50,7 @@ public class PerforceLoginConsumerTest
 
         PerforceLoginConsumer consumer = new PerforceLoginConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.isSuccess() );
         assertTrue( consumer.getOutput().startsWith( "Password invalid." ) );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
index fab19ce..2576e18 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/remove/PerforceRemoveConsumerTest.java
@@ -19,14 +19,12 @@ package 
org.apache.maven.scm.provider.perforce.command.remove;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse</a>
@@ -42,14 +40,7 @@ public class PerforceRemoveConsumerTest
 
         PerforceRemoveConsumer consumer = new PerforceRemoveConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         List<ScmFile> removes = consumer.getRemovals();
         assertEquals( "Wrong number of entries returned", 2, removes.size() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
index 2fb5a0b..760f568 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/status/PerforceStatusConsumerTest.java
@@ -22,11 +22,9 @@ package 
org.apache.maven.scm.provider.perforce.command.status;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 /**
@@ -42,14 +40,7 @@ public class PerforceStatusConsumerTest
 
         PerforceStatusConsumer consumer = new PerforceStatusConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
index 708f83e..1417ce3 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagConsumerTest.java
@@ -19,14 +19,12 @@ package org.apache.maven.scm.provider.perforce.command.tag;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -41,14 +39,7 @@ public class PerforceTagConsumerTest
 
         PerforceTagConsumer consumer = new PerforceTagConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertEquals( "", consumer.getOutput() );
         assertTrue( consumer.isSuccess() );
@@ -65,14 +56,7 @@ public class PerforceTagConsumerTest
 
         PerforceTagConsumer consumer = new PerforceTagConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.isSuccess() );
         assertTrue(
diff --git 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
index 3b012ce..d15b5ac 100644
--- 
a/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-perforce/src/test/java/org/apache/maven/scm/provider/perforce/command/unedit/PerforceUnEditConsumerTest.java
@@ -19,14 +19,12 @@ package 
org.apache.maven.scm.provider.perforce.command.unedit;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.List;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:eveni...@apache.org";>Emmanuel Venisse </a>
@@ -41,14 +39,7 @@ public class PerforceUnEditConsumerTest
 
         PerforceUnEditConsumer consumer = new PerforceUnEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertTrue( consumer.isSuccess() );
         List<ScmFile> edits = consumer.getEdits();
@@ -65,14 +56,7 @@ public class PerforceUnEditConsumerTest
 
         PerforceUnEditConsumer consumer = new PerforceUnEditConsumer();
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         assertFalse( consumer.isSuccess() );
         assertTrue( consumer.getOutput().indexOf( ".classpath - file(s) not 
opened on this client." ) == 0 );
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
index 7b98214..8f3a0a7 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/changelog/StarteamChangeLogConsumerTest.java
@@ -22,11 +22,9 @@ package 
org.apache.maven.scm.provider.starteam.command.changelog;
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
@@ -62,21 +60,10 @@ public class StarteamChangeLogConsumerTest
 
         File basedir = new File( "C:/Test" );
 
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         StarteamChangeLogConsumer consumer =
             new StarteamChangeLogConsumer( basedir, new DefaultLog(), null, 
null, null );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         return consumer.getModifications();
     }
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
index d22f72d..b550ad1 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/diff/StarteamDiffConsumerTest.java
@@ -19,15 +19,13 @@ package org.apache.maven.scm.provider.starteam.command.diff;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Collection;
 
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:dant...@gmail.com";>Dan T. Tran</a>
@@ -48,22 +46,11 @@ public class StarteamDiffConsumerTest
     public void testParse()
         throws Exception
     {
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         File basedir = new File( getBasedir() );
 
         StarteamDiffConsumer consumer = new StarteamDiffConsumer( new 
DefaultLog(), basedir );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Collection<ScmFile> entries = consumer.getChangedFiles();
 
diff --git 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
index 43d93a3..bd1144c 100644
--- 
a/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-starteam/src/test/java/org/apache/maven/scm/provider/starteam/command/status/StarteamStatusConsumerTest.java
@@ -19,13 +19,11 @@ package 
org.apache.maven.scm.provider.starteam.command.status;
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
 /**
  * @author <a href="mailto:dant...@gmail.com";>Dan T. Tran</a>
@@ -49,20 +47,9 @@ public class StarteamStatusConsumerTest
     public void testParse()
         throws Exception
     {
-        FileInputStream fis = new FileInputStream( testFile );
-
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-
-        String s = in.readLine();
-
         StarteamStatusConsumer consumer = new StarteamStatusConsumer( new 
DefaultLog(), new File( WORKING_DIR ) );
 
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
         
         assertEquals( "Wrong number of entries returned", 4, 
consumer.getChangedFiles().size() );
 
diff --git 
a/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
index 4984231..c0b324b 100644
--- 
a/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-provider-tfs/src/test/java/org/apache/maven/scm/provider/tfs/command/blame/TfsBlameConsumerTest.java
@@ -23,11 +23,9 @@ import junit.framework.Assert;
 import org.apache.maven.scm.ScmTestCase;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 
 /**
  * @author Evgeny Mandrikov
@@ -43,14 +41,7 @@ public class TfsBlameConsumerTest
 
         TfsBlameConsumer consumer = new TfsBlameConsumer( new DefaultLog() );
 
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            consumer.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, consumer );
 
         Assert.assertEquals( 3, consumer.getLines().size() );
 
diff --git 
a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
index 07fb3cb..2e98e8b 100644
--- 
a/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-cvs/maven-scm-provider-cvs-commons/src/test/java/org/apache/maven/scm/provider/cvslib/command/changelog/CvsChangeLogConsumerTest.java
@@ -22,11 +22,9 @@ package 
org.apache.maven.scm.provider.cvslib.command.changelog;
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.log.DefaultLog;
 import org.apache.maven.scm.provider.cvslib.AbstractCvsScmTest;
+import org.apache.maven.scm.util.ConsumerUtils;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -65,15 +63,7 @@ public class CvsChangeLogConsumerTest
         throws Exception
     {
         CvsChangeLogConsumer command = new CvsChangeLogConsumer( new 
DefaultLog(), null );
-
-        FileInputStream fis = new FileInputStream( testFile );
-        BufferedReader in = new BufferedReader( new InputStreamReader( fis ) );
-        String s = in.readLine();
-        while ( s != null )
-        {
-            command.consumeLine( s );
-            s = in.readLine();
-        }
+        ConsumerUtils.consumeFile( testFile, command );
 
         Collection<ChangeSet> entries = command.getModifications();
         assertEquals( "Wrong number of entries returned", 3, entries.size() );
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
index 12830ac..99d24e6 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-git-commons/src/test/java/org/apache/maven/scm/provider/git/command/diff/GitDiffConsumerTest.java
@@ -22,11 +22,10 @@ package org.apache.maven.scm.provider.git.command.diff;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 import java.util.Map;
 
@@ -44,14 +43,7 @@ public class GitDiffConsumerTest
 
         File f = getTestFile( 
"/src/test/resources/git/diff/git-diff-empty.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
@@ -65,14 +57,7 @@ public class GitDiffConsumerTest
 
         File f = getTestFile( "src/test/resources/git/diff/git-diff1.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
@@ -95,14 +80,7 @@ public class GitDiffConsumerTest
 
         File f = getTestFile( "src/test/resources/git/diff/git-diff2.log" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getChangedFiles();
 
@@ -130,4 +108,4 @@ public class GitDiffConsumerTest
         assertEquals( expectedStatus, fileToTest.getStatus() );
     }
  
-}
\ No newline at end of file
+}
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
index a7671b6..502bdf9 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/blame/GitBlameConsumerTest.java
@@ -22,6 +22,7 @@ package 
org.apache.maven.scm.provider.git.gitexe.command.blame;
 import junit.framework.Assert;
 import org.apache.maven.scm.command.blame.BlameLine;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
 import java.io.BufferedReader;
@@ -54,7 +55,6 @@ public class GitBlameConsumerTest
         Assert.assertNotNull( blameLine.getDate() );
     }
 
-
     public void testConsumer()
         throws Exception
     {
@@ -80,7 +80,6 @@ public class GitBlameConsumerTest
         Assert.assertEquals( 0, consumer.getLines().size() );
     }
 
-
     /**
      * Test what happens if a git-blame command got invoked on a
      * file which didn't got added to the git repo yet.
@@ -158,7 +157,7 @@ public class GitBlameConsumerTest
             Assert.assertEquals( "error in line " + lineNr, parts[1], 
blameLine.getAuthor() );
             Assert.assertEquals( "error in line " + lineNr, parts[2], 
blameDateFormat.format( blameLine.getDate() ) );
 
-            lineNr ++;
+            lineNr++;
         }
 
         if ( consumerLineIt.hasNext() )
@@ -166,7 +165,6 @@ public class GitBlameConsumerTest
             fail( "GitBlameConsumer found more lines than in the original 
output!" );
         }
 
-
     }
 
     /**
@@ -182,14 +180,9 @@ public class GitBlameConsumerTest
 
         File f = getTestFile( fileName );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
+        ConsumerUtils.consumeFile( f, consumer );
 
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
         return consumer;
     }
+
 }
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
index c8365bf..e28bf71 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogConsumerTest.java
@@ -23,12 +23,11 @@ import org.apache.maven.scm.ChangeFile;
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 import org.junit.Assert;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.text.SimpleDateFormat;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -53,7 +52,7 @@ public class GitChangeLogConsumerTest
         //iso  Date:   2007-11-24 01:13:10 +0100
         Pattern datePattern = Pattern.compile( "^Date:\\s*(.*)" );//new RE( 
"^Date:\\s*\\w-1\\w-1\\w-1\\s(.*)" );
         Matcher matcher = datePattern.matcher( "Date:   2007-11-24 01:13:10 
+0100" );
-        
+
         assertTrue( matcher.matches() );
         assertEquals("2007-11-24 01:13:10 +0100", matcher.group( 1 ));
 
@@ -61,14 +60,7 @@ public class GitChangeLogConsumerTest
 
         File f = getTestFile( 
"/src/test/resources/git/changelog/gitwhatchanged.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ChangeSet> modifications = consumer.getModifications();
 
@@ -117,14 +109,7 @@ public class GitChangeLogConsumerTest
 
         File f = getTestFile( 
"/src/test/resources/git/changelog/gitwhatchanged2.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ChangeSet> modifications = consumer.getModifications();
 
diff --git 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
index 55f3a0a..7e9a364 100644
--- 
a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/remove/GitRemoveConsumerTest.java
@@ -23,11 +23,10 @@ import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
 import 
org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveConsumer;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.util.List;
 
 /**
@@ -56,14 +55,7 @@ public class GitRemoveConsumerTest
 
         File f = getTestFile( "/src/test/resources/git/remove/gitrm.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getRemovedFiles();
         
@@ -80,14 +72,7 @@ public class GitRemoveConsumerTest
 
         File f = getTestFile( 
"/src/test/resources/git/remove/gitrm-empty.gitlog" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ScmFile> changedFiles = consumer.getRemovedFiles();
         
diff --git 
a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
 
b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
index 7ed4403..09fd0dc 100644
--- 
a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
+++ 
b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/test/java/org/apache/maven/scm/provider/svn/svnexe/command/changelog/SvnChangeLogConsumerTest.java
@@ -23,13 +23,12 @@ import org.apache.maven.scm.ChangeFile;
 import org.apache.maven.scm.ChangeSet;
 import org.apache.maven.scm.ScmFileStatus;
 import org.apache.maven.scm.log.DefaultLog;
+import org.apache.maven.scm.util.ConsumerUtils;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.logging.Logger;
 import org.junit.Assert;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.IOException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -154,14 +153,7 @@ public class SvnChangeLogConsumerTest
     private void consumeLog( final File logFile )
         throws IOException
     {
-        final BufferedReader reader = new BufferedReader( new FileReader( 
logFile ) );
-        String line = reader.readLine();
-
-        while ( line != null )
-        {
-            consumer.consumeLine( line );
-            line = reader.readLine();
-        }
+        ConsumerUtils.consumeFile( logFile, consumer );
     }
 
     public void testConsumerWithPattern1()
@@ -171,14 +163,7 @@ public class SvnChangeLogConsumerTest
 
         File f = getTestFile( "/src/test/resources/svn/changelog/svnlog.txt" );
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List<ChangeSet> modifications = consumer.getModifications();
 
@@ -228,14 +213,7 @@ public class SvnChangeLogConsumerTest
 
         File f = getTestFile( "/src/test/resources/svn/changelog/svnlog2.txt" 
);
 
-        BufferedReader r = new BufferedReader( new FileReader( f ) );
-
-        String line;
-
-        while ( ( line = r.readLine() ) != null )
-        {
-            consumer.consumeLine( line );
-        }
+        ConsumerUtils.consumeFile( f, consumer );
 
         List modifications = consumer.getModifications();
 

Reply via email to