You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mrunit.apache.org by jd...@apache.org on 2012/03/14 02:43:52 UTC

svn commit: r1300437 [2/4] - in /incubator/mrunit/trunk/src: main/java/org/apache/hadoop/mrunit/ main/java/org/apache/hadoop/mrunit/mapreduce/ main/java/org/apache/hadoop/mrunit/mapreduce/mock/ main/java/org/apache/hadoop/mrunit/mock/ main/java/org/apa...

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java Wed Mar 14 01:43:51 2012
@@ -34,7 +34,7 @@ public abstract class TestDriver<K1, V1,
   public static final Log LOG = LogFactory.getLog(TestDriver.class);
 
   protected List<Pair<K2, V2>> expectedOutputs;
-  
+
   protected Configuration configuration;
 
   public TestDriver() {
@@ -57,8 +57,9 @@ public abstract class TestDriver<K1, V1,
   }
 
   /**
-   * Runs the test but returns the result set instead of validating it
-   * (ignores any addOutput(), etc calls made before this)
+   * Runs the test but returns the result set instead of validating it (ignores
+   * any addOutput(), etc calls made before this)
+   * 
    * @return the list of (k, v) pairs returned as output from the test
    */
   public abstract List<Pair<K2, V2>> run() throws IOException;
@@ -70,9 +71,10 @@ public abstract class TestDriver<K1, V1,
 
   /**
    * Split "key \t val" into Pair(Text(key), Text(val))
+   * 
    * @param tabSeparatedPair
    */
-  public static Pair<Text, Text> parseTabbedPair(String tabSeparatedPair) {
+  public static Pair<Text, Text> parseTabbedPair(final String tabSeparatedPair) {
 
     String key, val;
 
@@ -80,7 +82,7 @@ public abstract class TestDriver<K1, V1,
       return null;
     }
 
-    int split = tabSeparatedPair.indexOf('\t');
+    final int split = tabSeparatedPair.indexOf('\t');
     if (-1 == split) {
       return null;
     }
@@ -93,16 +95,19 @@ public abstract class TestDriver<K1, V1,
 
   /**
    * Split "val,val,val,val..." into a List of Text(val) objects.
-   * @param commaDelimList A list of values separated by commas
+   * 
+   * @param commaDelimList
+   *          A list of values separated by commas
    */
-  protected static List<Text> parseCommaDelimitedList(String commaDelimList) {
-    ArrayList<Text> outList = new ArrayList<Text>();
+  protected static List<Text> parseCommaDelimitedList(
+      final String commaDelimList) {
+    final ArrayList<Text> outList = new ArrayList<Text>();
 
     if (null == commaDelimList) {
       return null;
     }
 
-    int len = commaDelimList.length();
+    final int len = commaDelimList.length();
     int curPos = 0;
     int curComma = commaDelimList.indexOf(',');
     if (curComma == -1) {
@@ -110,8 +115,7 @@ public abstract class TestDriver<K1, V1,
     }
 
     while (curPos < len) {
-      outList.add(new Text(
-              commaDelimList.substring(curPos, curComma).trim()));
+      outList.add(new Text(commaDelimList.substring(curPos, curComma).trim()));
       curPos = curComma + 1;
       curComma = commaDelimList.indexOf(',', curPos);
       if (curComma == -1) {
@@ -124,16 +128,19 @@ public abstract class TestDriver<K1, V1,
 
   /**
    * check the outputs against the expected inputs in record
-   * @param outputs The actual output (k, v) pairs
+   * 
+   * @param outputs
+   *          The actual output (k, v) pairs
    */
-  protected void validate(List<Pair<K2, V2>> outputs) {
+  protected void validate(final List<Pair<K2, V2>> outputs) {
 
     boolean success = true;
-    List<String> errors = new ArrayList<String>();
+    final List<String> errors = new ArrayList<String>();
     // were we supposed to get output in the first place?
     // return false if we don't.
     if (expectedOutputs.size() == 0 && outputs.size() > 0) {
-      String msg = "Expected no outputs; got " + outputs.size() + " outputs.";
+      final String msg = "Expected no outputs; got " + outputs.size()
+          + " outputs.";
       LOG.error(msg);
       errors.add(msg);
       success = false;
@@ -142,7 +149,7 @@ public abstract class TestDriver<K1, V1,
     // make sure all actual outputs are in the expected set,
     // and at the proper position.
     for (int i = 0; i < outputs.size(); i++) {
-      Pair<K2, V2> actual = outputs.get(i);
+      final Pair<K2, V2> actual = outputs.get(i);
       success = lookupExpectedValue(actual, i, errors) && success;
     }
 
@@ -150,11 +157,11 @@ public abstract class TestDriver<K1, V1,
     if (expectedOutputs.size() != outputs.size() || !success) {
       // something is unaccounted for. Figure out what.
 
-      ArrayList<Pair<K2, V2>> actuals = new ArrayList<Pair<K2, V2>>();
+      final ArrayList<Pair<K2, V2>> actuals = new ArrayList<Pair<K2, V2>>();
       actuals.addAll(outputs);
 
       for (int i = 0; i < expectedOutputs.size(); i++) {
-        Pair<K2, V2> expected = expectedOutputs.get(i);
+        final Pair<K2, V2> expected = expectedOutputs.get(i);
 
         String expectedStr = "(null)";
         if (null != expected) {
@@ -163,23 +170,29 @@ public abstract class TestDriver<K1, V1,
 
         boolean found = false;
         for (int j = 0; j < actuals.size() && !found; j++) {
-          Pair<K2, V2> actual = actuals.get(j);
+          final Pair<K2, V2> actual = actuals.get(j);
 
           if (actual.equals(expected)) {
             // don't match against this actual output again
             actuals.remove(j);
 
             found = true;
-          } else if (actual.getFirst().getClass() != expected.getFirst().getClass()) {
-            String msg = "Missing expected output " + expectedStr + ": Mismatch in key class: expected: " +
-                expected.getFirst().getClass() + " " + "actual: " + actual.getFirst().getClass();
+          } else if (actual.getFirst().getClass() != expected.getFirst()
+              .getClass()) {
+            final String msg = "Missing expected output " + expectedStr
+                + ": Mismatch in key class: expected: "
+                + expected.getFirst().getClass() + " " + "actual: "
+                + actual.getFirst().getClass();
             LOG.error(msg);
             errors.add(msg);
 
             found = true;
-          } else if (actual.getSecond().getClass() != expected.getSecond().getClass()) {
-            String msg =  "Missing expected output " + expectedStr + ": Mismatch in value class: expected: " +
-                expected.getSecond().getClass() + " " + "actual: " + actual.getSecond().getClass();
+          } else if (actual.getSecond().getClass() != expected.getSecond()
+              .getClass()) {
+            final String msg = "Missing expected output " + expectedStr
+                + ": Mismatch in value class: expected: "
+                + expected.getSecond().getClass() + " " + "actual: "
+                + actual.getSecond().getClass();
             LOG.error(msg);
             errors.add(msg);
 
@@ -188,7 +201,8 @@ public abstract class TestDriver<K1, V1,
         }
 
         if (!found) {
-          String msg = "Missing expected output " + expectedStr + " at position " + i + ".";
+          final String msg = "Missing expected output " + expectedStr
+              + " at position " + i + ".";
           LOG.error(msg);
           errors.add(msg);
         }
@@ -198,7 +212,7 @@ public abstract class TestDriver<K1, V1,
     }
 
     if (!success) {
-      StringBuilder buffer = new StringBuilder();
+      final StringBuilder buffer = new StringBuilder();
       buffer.append(errors.size()).append(" Error(s): ");
       formatValueList(errors, buffer);
       fail(buffer.toString());
@@ -207,17 +221,22 @@ public abstract class TestDriver<K1, V1,
 
   /**
    * Part of the validation system.
-   * @param actualVal A (k, v) pair we got from the Mapper
-   * @param actualPos The position of this pair in the actual output
-   * @return true if the expected val at 'actualPos' in the expected
-   *              list equals actualVal
+   * 
+   * @param actualVal
+   *          A (k, v) pair we got from the Mapper
+   * @param actualPos
+   *          The position of this pair in the actual output
+   * @return true if the expected val at 'actualPos' in the expected list equals
+   *         actualVal
    */
-  private boolean lookupExpectedValue(Pair<K2, V2> actualVal, int actualPos, List<String> errors) {
+  private boolean lookupExpectedValue(final Pair<K2, V2> actualVal,
+      final int actualPos, final List<String> errors) {
 
     // first: Do we have the success condition?
     if (expectedOutputs.size() > actualPos
-            && expectedOutputs.get(actualPos).equals(actualVal)) {
-      LOG.debug("Matched expected output " + actualVal.toString() + " at position " + actualPos);
+        && expectedOutputs.get(actualPos).equals(actualVal)) {
+      LOG.debug("Matched expected output " + actualVal.toString()
+          + " at position " + actualPos);
       return true;
     }
 
@@ -226,25 +245,32 @@ public abstract class TestDriver<K1, V1,
     boolean foundSomewhere = false;
 
     for (int i = 0; i < expectedOutputs.size() && !foundSomewhere; i++) {
-      Pair<K2, V2> expected = expectedOutputs.get(i);
+      final Pair<K2, V2> expected = expectedOutputs.get(i);
 
       if (expected.equals(actualVal)) {
-        String msg = "Matched expected output " + actualVal.toString() + " but at incorrect position "
-            + actualPos + " (expected position " + i + ")";
+        final String msg = "Matched expected output " + actualVal.toString()
+            + " but at incorrect position " + actualPos
+            + " (expected position " + i + ")";
         LOG.error(msg);
         errors.add(msg);
 
         foundSomewhere = true;
-      } else if (actualVal.getFirst().getClass() != expected.getFirst().getClass()) {
-        String msg = "Received unexpected output " + actualVal.toString() + ": Mismatch in key class: expected: " +
-            expected.getFirst().getClass() + " " + "actual: " + actualVal.getFirst().getClass();
+      } else if (actualVal.getFirst().getClass() != expected.getFirst()
+          .getClass()) {
+        final String msg = "Received unexpected output " + actualVal.toString()
+            + ": Mismatch in key class: expected: "
+            + expected.getFirst().getClass() + " " + "actual: "
+            + actualVal.getFirst().getClass();
         LOG.error(msg);
         errors.add(msg);
 
         foundSomewhere = true;
-      } else if (actualVal.getSecond().getClass() != expected.getSecond().getClass()) {
-        String msg =  "Received unexpected output " + actualVal.toString() + ": Mismatch in value class: expected: " +
-            expected.getSecond().getClass() + " " + "actual: " + actualVal.getSecond().getClass();
+      } else if (actualVal.getSecond().getClass() != expected.getSecond()
+          .getClass()) {
+        final String msg = "Received unexpected output " + actualVal.toString()
+            + ": Mismatch in value class: expected: "
+            + expected.getSecond().getClass() + " " + "actual: "
+            + actualVal.getSecond().getClass();
         LOG.error(msg);
         errors.add(msg);
 
@@ -253,7 +279,7 @@ public abstract class TestDriver<K1, V1,
     }
 
     if (!foundSomewhere) {
-      String msg = "Received unexpected output " + actualVal.toString();
+      final String msg = "Received unexpected output " + actualVal.toString();
       LOG.error(msg);
       errors.add(msg);
     }
@@ -261,13 +287,14 @@ public abstract class TestDriver<K1, V1,
     return false;
   }
 
-  protected static void formatValueList(List<?> values, StringBuilder sb) {
+  protected static void formatValueList(final List<?> values,
+      final StringBuilder sb) {
     sb.append("(");
 
     if (null != values) {
       boolean first = true;
 
-      for (Object val : values) {
+      for (final Object val : values) {
         if (!first) {
           sb.append(", ");
         }
@@ -280,19 +307,20 @@ public abstract class TestDriver<K1, V1,
     sb.append(")");
   }
 
-  /** 
-   * @return The configuration object that will given to the mapper and/or 
+  /**
+   * @return The configuration object that will given to the mapper and/or
    *         reducer associated with the driver (new API only)
    */
   public Configuration getConfiguration() {
     return configuration;
   }
-  
+
   /**
-   * @param configuration The configuration object that will given to the 
-   *        mapper and/or reducer associated with the driver (new API only)
+   * @param configuration
+   *          The configuration object that will given to the mapper and/or
+   *          reducer associated with the driver (new API only)
    */
-  public void setConfiguration(Configuration configuration) {
+  public void setConfiguration(final Configuration configuration) {
     this.configuration = configuration;
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java Wed Mar 14 01:43:51 2012
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.mrunit.mapreduce;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -33,13 +32,13 @@ import org.apache.hadoop.mrunit.mapreduc
 import org.apache.hadoop.mrunit.types.Pair;
 
 /**
- * Harness that allows you to test a Mapper instance. You provide the input
- * key and value that should be sent to the Mapper, and outputs you expect to
- * be sent by the Mapper to the collector for those inputs. By calling
- * runTest(), the harness will deliver the input to the Mapper and will check
- * its outputs against the expected results. This is designed to handle a
- * single (k, v) -> (k, v)* case from the Mapper, representing a single unit
- * test. Multiple input (k, v) pairs should go in separate unit tests.
+ * Harness that allows you to test a Mapper instance. You provide the input key
+ * and value that should be sent to the Mapper, and outputs you expect to be
+ * sent by the Mapper to the collector for those inputs. By calling runTest(),
+ * the harness will deliver the input to the Mapper and will check its outputs
+ * against the expected results. This is designed to handle a single (k, v) ->
+ * (k, v)* case from the Mapper, representing a single unit test. Multiple input
+ * (k, v) pairs should go in separate unit tests.
  */
 public class MapDriver<K1, V1, K2, V2> extends MapDriverBase<K1, V1, K2, V2> {
 
@@ -57,18 +56,18 @@ public class MapDriver<K1, V1, K2, V2> e
     counters = new Counters();
   }
 
-
   /**
    * Set the Mapper instance to use with this test driver
-   *
-   * @param m the Mapper instance to use
+   * 
+   * @param m
+   *          the Mapper instance to use
    */
-  public void setMapper(Mapper<K1, V1, K2, V2> m) {
+  public void setMapper(final Mapper<K1, V1, K2, V2> m) {
     myMapper = m;
   }
 
   /** Sets the Mapper instance to use and returns self for fluent style */
-  public MapDriver<K1, V1, K2, V2> withMapper(Mapper<K1, V1, K2, V2> m) {
+  public MapDriver<K1, V1, K2, V2> withMapper(final Mapper<K1, V1, K2, V2> m) {
     setMapper(m);
     return this;
   }
@@ -85,8 +84,11 @@ public class MapDriver<K1, V1, K2, V2> e
     return counters;
   }
 
-  /** Sets the counters object to use for this test.
-   * @param ctrs The counters object to use.
+  /**
+   * Sets the counters object to use for this test.
+   * 
+   * @param ctrs
+   *          The counters object to use.
    */
   public void setCounters(final Counters ctrs) {
     this.counters = ctrs;
@@ -100,92 +102,93 @@ public class MapDriver<K1, V1, K2, V2> e
 
   /**
    * Identical to setInputKey() but with fluent programming style
-   *
+   * 
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withInputKey(K1 key) {
+  public MapDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
     setInputKey(key);
     return this;
   }
 
   /**
    * Identical to setInputValue() but with fluent programming style
-   *
+   * 
    * @param val
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withInputValue(V1 val) {
+  public MapDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
     setInputValue(val);
     return this;
   }
 
   /**
    * Identical to setInput() but returns self for fluent programming style
-   *
+   * 
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withInput(K1 key, V1 val) {
+  public MapDriver<K1, V1, K2, V2> withInput(final K1 key, final V1 val) {
     setInput(key, val);
     return this;
   }
 
   /**
    * Identical to setInput() but returns self for fluent programming style
-   *
+   * 
    * @param inputRecord
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withInput(Pair<K1, V1> inputRecord) {
+  public MapDriver<K1, V1, K2, V2> withInput(final Pair<K1, V1> inputRecord) {
     setInput(inputRecord);
     return this;
   }
 
   /**
    * Works like addOutput(), but returns self for fluent style
-   *
+   * 
    * @param outputRecord
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withOutput(Pair<K2, V2> outputRecord) {
+  public MapDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
     addOutput(outputRecord);
     return this;
   }
 
   /**
-   * Functions like addOutput() but returns self for fluent programming
-   * style
-   *
+   * Functions like addOutput() but returns self for fluent programming style
+   * 
    * @return this
    */
-  public MapDriver<K1, V1, K2, V2> withOutput(K2 key, V2 val) {
+  public MapDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
     addOutput(key, val);
     return this;
   }
 
   /**
    * Identical to setInputFromString, but with a fluent programming style
-   *
+   * 
    * @param input
    *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public MapDriver<K1, V1, K2, V2> withInputFromString(String input) {
+  public MapDriver<K1, V1, K2, V2> withInputFromString(final String input) {
     setInputFromString(input);
     return this;
   }
 
   /**
    * Identical to addOutputFromString, but with a fluent programming style
-   *
+   * 
    * @param output
    *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public MapDriver<K1, V1, K2, V2> withOutputFromString(String output) {
+  public MapDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
     addOutputFromString(output);
     return this;
   }
@@ -196,17 +199,17 @@ public class MapDriver<K1, V1, K2, V2> e
       throw new IllegalStateException("No Mapper class was provided");
     }
 
-    List<Pair<K1, V1>> inputs = new ArrayList<Pair<K1, V1>>();
+    final List<Pair<K1, V1>> inputs = new ArrayList<Pair<K1, V1>>();
     inputs.add(new Pair<K1, V1>(inputKey, inputVal));
 
     try {
-      MockMapContextWrapper<K1, V1, K2, V2> wrapper = 
-        new MockMapContextWrapper<K1, V1, K2, V2>(inputs, getCounters(), getConfiguration());
-      
-      Mapper<K1, V1, K2, V2>.Context context = wrapper.getMockContext();
+      final MockMapContextWrapper<K1, V1, K2, V2> wrapper = new MockMapContextWrapper<K1, V1, K2, V2>(
+          inputs, getCounters(), getConfiguration());
+
+      final Mapper<K1, V1, K2, V2>.Context context = wrapper.getMockContext();
       myMapper.run(context);
       return wrapper.getOutputs();
-    } catch (InterruptedException ie) {
+    } catch (final InterruptedException ie) {
       throw new IOException(ie);
     }
   }
@@ -215,38 +218,39 @@ public class MapDriver<K1, V1, K2, V2> e
   public String toString() {
     return "MapDriver (0.20+) (" + myMapper + ")";
   }
-  
-  /** 
-   * @param configuration The configuration object that will given to the mapper
-   *        associated with the driver
+
+  /**
+   * @param configuration
+   *          The configuration object that will given to the mapper associated
+   *          with the driver
    * @return this object for fluent coding
    */
-  public MapDriver<K1, V1, K2, V2> withConfiguration(Configuration configuration) {
+  public MapDriver<K1, V1, K2, V2> withConfiguration(
+      final Configuration configuration) {
     setConfiguration(configuration);
-	  return this;
+    return this;
   }
-  
-  
+
   /**
-   * Returns a new MapDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new MapDriver without having to specify the generic types on the
+   * right hand side of the object create statement.
    * 
    * @return new MapDriver
    */
-  public static <K1, V1, K2, V2>  MapDriver<K1, V1, K2, V2> newMapDriver() {
+  public static <K1, V1, K2, V2> MapDriver<K1, V1, K2, V2> newMapDriver() {
     return new MapDriver<K1, V1, K2, V2>();
   }
+
   /**
-   * Returns a new MapDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new MapDriver without having to specify the generic types on the
+   * right hand side of the object create statement.
    * 
-   * @param mapper passed to MapDriver constructor
+   * @param mapper
+   *          passed to MapDriver constructor
    * @return new MapDriver
    */
-  public static <K1, V1, K2, V2>  MapDriver<K1, V1, K2, V2> newMapDriver(Mapper<K1, V1, K2, V2> mapper) {
+  public static <K1, V1, K2, V2> MapDriver<K1, V1, K2, V2> newMapDriver(
+      final Mapper<K1, V1, K2, V2> mapper) {
     return new MapDriver<K1, V1, K2, V2>(mapper);
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapReduceDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapReduceDriver.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapReduceDriver.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapReduceDriver.java Wed Mar 14 01:43:51 2012
@@ -17,10 +17,10 @@
  */
 package org.apache.hadoop.mrunit.mapreduce;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -32,18 +32,18 @@ import org.apache.hadoop.mrunit.MapReduc
 import org.apache.hadoop.mrunit.types.Pair;
 
 /**
- * Harness that allows you to test a Mapper and a Reducer instance together
- * You provide the input key and value that should be sent to the Mapper, and
+ * Harness that allows you to test a Mapper and a Reducer instance together You
+ * provide the input key and value that should be sent to the Mapper, and
  * outputs you expect to be sent by the Reducer to the collector for those
  * inputs. By calling runTest(), the harness will deliver the input to the
- * Mapper, feed the intermediate results to the Reducer (without checking
- * them), and will check the Reducer's outputs against the expected results.
- * This is designed to handle a single (k, v)* -> (k, v)* case from the
- * Mapper/Reducer pair, representing a single unit test.
+ * Mapper, feed the intermediate results to the Reducer (without checking them),
+ * and will check the Reducer's outputs against the expected results. This is
+ * designed to handle a single (k, v)* -> (k, v)* case from the Mapper/Reducer
+ * pair, representing a single unit test.
  */
 @SuppressWarnings("rawtypes")
-public class MapReduceDriver<K1, V1, K2 extends Comparable, V2, K3, V3>
-    extends MapReduceDriverBase<K1, V1, K2, V2, K3, V3> {
+public class MapReduceDriver<K1, V1, K2 extends Comparable, V2, K3, V3> extends
+    MapReduceDriverBase<K1, V1, K2, V2, K3, V3> {
 
   public static final Log LOG = LogFactory.getLog(MapReduceDriver.class);
 
@@ -52,7 +52,7 @@ public class MapReduceDriver<K1, V1, K2 
   private Counters counters;
 
   public MapReduceDriver(final Mapper<K1, V1, K2, V2> m,
-                         final Reducer<K2, V2, K3, V3> r) {
+      final Reducer<K2, V2, K3, V3> r) {
     myMapper = m;
     myReducer = r;
     counters = new Counters();
@@ -62,15 +62,19 @@ public class MapReduceDriver<K1, V1, K2 
     counters = new Counters();
   }
 
-  /** Set the Mapper instance to use with this test driver
-   * @param m the Mapper instance to use */
-  public void setMapper(Mapper<K1, V1, K2, V2> m) {
+  /**
+   * Set the Mapper instance to use with this test driver
+   * 
+   * @param m
+   *          the Mapper instance to use
+   */
+  public void setMapper(final Mapper<K1, V1, K2, V2> m) {
     myMapper = m;
   }
 
   /** Sets the Mapper instance to use and returns self for fluent style */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withMapper(
-          Mapper<K1, V1, K2, V2> m) {
+      final Mapper<K1, V1, K2, V2> m) {
     setMapper(m);
     return this;
   }
@@ -84,19 +88,23 @@ public class MapReduceDriver<K1, V1, K2 
 
   /**
    * Sets the reducer object to use for this test
-   * @param r The reducer object to use
+   * 
+   * @param r
+   *          The reducer object to use
    */
-  public void setReducer(Reducer<K2, V2, K3, V3> r) {
+  public void setReducer(final Reducer<K2, V2, K3, V3> r) {
     myReducer = r;
   }
 
   /**
    * Identical to setReducer(), but with fluent programming style
-   * @param r The Reducer to use
+   * 
+   * @param r
+   *          The Reducer to use
    * @return this
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withReducer(
-          Reducer<K2, V2, K3, V3> r) {
+      final Reducer<K2, V2, K3, V3> r) {
     setReducer(r);
     return this;
   }
@@ -113,116 +121,136 @@ public class MapReduceDriver<K1, V1, K2 
     return counters;
   }
 
-  /** Sets the counters object to use for this test.
-   * @param ctrs The counters object to use.
+  /**
+   * Sets the counters object to use for this test.
+   * 
+   * @param ctrs
+   *          The counters object to use.
    */
   public void setCounters(final Counters ctrs) {
     this.counters = ctrs;
   }
 
   /** Sets the counters to use and returns self for fluent style */
-  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withCounters(final Counters ctrs) {
+  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withCounters(
+      final Counters ctrs) {
     setCounters(ctrs);
     return this;
   }
 
   /**
    * Identical to addInput() but returns self for fluent programming style
+   * 
    * @param key
    * @param val
    * @return this
    */
-  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInput(K1 key, V1 val) {
+  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInput(final K1 key,
+      final V1 val) {
     addInput(key, val);
     return this;
   }
 
   /**
    * Identical to addInput() but returns self for fluent programming style
-   * @param input The (k, v) pair to add
+   * 
+   * @param input
+   *          The (k, v) pair to add
    * @return this
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInput(
-      Pair<K1, V1> input) {
+      final Pair<K1, V1> input) {
     addInput(input);
     return this;
   }
 
   /**
    * Works like addOutput(), but returns self for fluent style
+   * 
    * @param outputRecord
    * @return this
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutput(
-          Pair<K3, V3> outputRecord) {
+      final Pair<K3, V3> outputRecord) {
     addOutput(outputRecord);
     return this;
   }
 
   /**
    * Functions like addOutput() but returns self for fluent programming style
+   * 
    * @param key
    * @param val
    * @return this
    */
-  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutput(K3 key, V3 val) {
+  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutput(final K3 key,
+      final V3 val) {
     addOutput(key, val);
     return this;
   }
 
   /**
    * Identical to addInputFromString, but with a fluent programming style
-   * @param input A string of the form "key \t val". Trims any whitespace.
+   * 
+   * @param input
+   *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInputFromString(String input) {
+  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInputFromString(
+      final String input) {
     addInputFromString(input);
     return this;
   }
 
   /**
    * Identical to addOutputFromString, but with a fluent programming style
-   * @param output A string of the form "key \t val". Trims any whitespace.
+   * 
+   * @param output
+   *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutputFromString(String output) {
+  public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutputFromString(
+      final String output) {
     addOutputFromString(output);
     return this;
   }
 
+  @Override
   public List<Pair<K3, V3>> run() throws IOException {
     if (inputList.size() == 0) {
       LOG.warn("No inputs configured to send to Mapper and Reducer; this is a trivial test.");
     }
 
-    List<Pair<K2, V2>> mapOutputs = new ArrayList<Pair<K2, V2>>();
+    final List<Pair<K2, V2>> mapOutputs = new ArrayList<Pair<K2, V2>>();
 
     // run map component
-    for (Pair<K1, V1> input : inputList) {
+    for (final Pair<K1, V1> input : inputList) {
       LOG.debug("Mapping input " + input.toString() + ")");
 
-      mapOutputs.addAll(MapDriver.newMapDriver(myMapper).withInput(
-              input).withCounters(getCounters()).withConfiguration(configuration).run());
+      mapOutputs.addAll(MapDriver.newMapDriver(myMapper).withInput(input)
+          .withCounters(getCounters()).withConfiguration(configuration).run());
     }
 
-    List<Pair<K2, List<V2>>> reduceInputs = shuffle(mapOutputs);
-    List<Pair<K3, V3>> reduceOutputs = new ArrayList<Pair<K3, V3>>();
+    final List<Pair<K2, List<V2>>> reduceInputs = shuffle(mapOutputs);
+    final List<Pair<K3, V3>> reduceOutputs = new ArrayList<Pair<K3, V3>>();
 
-    for (Pair<K2, List<V2>> input : reduceInputs) {
-      K2 inputKey = input.getFirst();
-      List<V2> inputValues = input.getSecond();
-      StringBuilder sb = new StringBuilder();
+    for (final Pair<K2, List<V2>> input : reduceInputs) {
+      final K2 inputKey = input.getFirst();
+      final List<V2> inputValues = input.getSecond();
+      final StringBuilder sb = new StringBuilder();
       formatValueList(inputValues, sb);
-      LOG.debug("Reducing input (" + inputKey.toString() + ", "
-          + sb.toString() + ")");
+      LOG.debug("Reducing input (" + inputKey.toString() + ", " + sb.toString()
+          + ")");
 
       reduceOutputs.addAll(ReduceDriver.newReduceDriver(myReducer)
-              .withCounters(getCounters()).withConfiguration(configuration)
-              .withInputKey(inputKey).withInputValues(inputValues).run());
+          .withCounters(getCounters()).withConfiguration(configuration)
+          .withInputKey(inputKey).withInputValues(inputValues).run());
     }
 
     return reduceOutputs;
@@ -232,70 +260,73 @@ public class MapReduceDriver<K1, V1, K2 
   public String toString() {
     return "MapReduceDriver (0.20+) (" + myMapper + ", " + myReducer + ")";
   }
-  
-  /** 
-   * @param configuration The configuration object that will given to the 
-   *        mapper and reducer associated with the driver
+
+  /**
+   * @param configuration
+   *          The configuration object that will given to the mapper and reducer
+   *          associated with the driver
    * @return this driver object for fluent coding
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withConfiguration(
-      Configuration configuration) {
+      final Configuration configuration) {
     setConfiguration(configuration);
     return this;
   }
-  
+
   /**
-   * Identical to {@link #setKeyGroupingComparator(RawComparator)}, but with a 
-   * fluent programming style 
-   * @param groupingComparator Comparator to use in the shuffle stage for key 
-   * grouping 
+   * Identical to {@link #setKeyGroupingComparator(RawComparator)}, but with a
+   * fluent programming style
+   * 
+   * @param groupingComparator
+   *          Comparator to use in the shuffle stage for key grouping
    * @return this
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withKeyGroupingComparator(
-      RawComparator<K2> groupingComparator) {
+      final RawComparator<K2> groupingComparator) {
     setKeyGroupingComparator(groupingComparator);
     return this;
   }
-  
+
   /**
-   * Identical to {@link #setKeyOrderComparator(RawComparator)}, but with a 
-   * fluent programming style 
-   * @param orderComparator Comparator to use in the shuffle stage for key 
-   * value ordering 
+   * Identical to {@link #setKeyOrderComparator(RawComparator)}, but with a
+   * fluent programming style
+   * 
+   * @param orderComparator
+   *          Comparator to use in the shuffle stage for key value ordering
    * @return this
    */
   public MapReduceDriver<K1, V1, K2, V2, K3, V3> withKeyOrderComparator(
-      RawComparator<K2> orderComparator) {
+      final RawComparator<K2> orderComparator) {
     setKeyOrderComparator(orderComparator);
     return this;
   }
-  
+
   /**
-   * Returns a new MapReduceDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new MapReduceDriver without having to specify the generic types
+   * on the right hand side of the object create statement.
    * 
-   * @param mapper passed to MapReduceDriver constructor
-   * @param reducer passed to MapReduceDriver constructor
+   * @param mapper
+   *          passed to MapReduceDriver constructor
+   * @param reducer
+   *          passed to MapReduceDriver constructor
    * @return new MapReduceDriver
    */
-  public static <K1, V1, K2 extends Comparable, V2, K3, V3>  
-  MapReduceDriver<K1, V1, K2, V2, K3, V3> newMapReduceDriver() {
+  public static <K1, V1, K2 extends Comparable, V2, K3, V3> MapReduceDriver<K1, V1, K2, V2, K3, V3> newMapReduceDriver() {
     return new MapReduceDriver<K1, V1, K2, V2, K3, V3>();
   }
+
   /**
-   * Returns a new MapReduceDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new MapReduceDriver without having to specify the generic types
+   * on the right hand side of the object create statement.
    * 
-   * @param mapper passed to MapReduceDriver constructor
-   * @param reducer passed to MapReduceDriver constructor
+   * @param mapper
+   *          passed to MapReduceDriver constructor
+   * @param reducer
+   *          passed to MapReduceDriver constructor
    * @return new MapReduceDriver
    */
-  public static <K1, V1, K2 extends Comparable, V2, K3, V3>  
-  MapReduceDriver<K1, V1, K2, V2, K3, V3> 
-  newMapReduceDriver(final Mapper<K1, V1, K2, V2> mapper,
-      final Reducer<K2, V2, K3, V3> reducer) {
+  public static <K1, V1, K2 extends Comparable, V2, K3, V3> MapReduceDriver<K1, V1, K2, V2, K3, V3> newMapReduceDriver(
+      final Mapper<K1, V1, K2, V2> mapper, final Reducer<K2, V2, K3, V3> reducer) {
     return new MapReduceDriver<K1, V1, K2, V2, K3, V3>(mapper, reducer);
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java Wed Mar 14 01:43:51 2012
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.mrunit.mapreduce;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -34,15 +33,16 @@ import org.apache.hadoop.mrunit.types.Pa
 
 /**
  * Harness that allows you to test a Reducer instance. You provide a key and a
- * set of intermediate values for that key that represent inputs that should
- * be sent to the Reducer (as if they came from a Mapper), and outputs you
- * expect to be sent by the Reducer to the collector. By calling runTest(),
- * the harness will deliver the input to the Reducer and will check its
- * outputs against the expected results. This is designed to handle a single
- * (k, v*) -> (k, v)* case from the Reducer, representing a single unit test.
- * Multiple input (k, v*) sets should go in separate unit tests.
+ * set of intermediate values for that key that represent inputs that should be
+ * sent to the Reducer (as if they came from a Mapper), and outputs you expect
+ * to be sent by the Reducer to the collector. By calling runTest(), the harness
+ * will deliver the input to the Reducer and will check its outputs against the
+ * expected results. This is designed to handle a single (k, v*) -> (k, v)* case
+ * from the Reducer, representing a single unit test. Multiple input (k, v*)
+ * sets should go in separate unit tests.
  */
-public class ReduceDriver<K1, V1, K2, V2> extends ReduceDriverBase<K1, V1, K2, V2> {
+public class ReduceDriver<K1, V1, K2, V2> extends
+    ReduceDriverBase<K1, V1, K2, V2> {
 
   public static final Log LOG = LogFactory.getLog(ReduceDriver.class);
 
@@ -60,22 +60,23 @@ public class ReduceDriver<K1, V1, K2, V2
 
   /**
    * Sets the reducer object to use for this test
-   *
+   * 
    * @param r
    *          The reducer object to use
    */
-  public void setReducer(Reducer<K1, V1, K2, V2> r) {
+  public void setReducer(final Reducer<K1, V1, K2, V2> r) {
     myReducer = r;
   }
 
   /**
    * Identical to setReducer(), but with fluent programming style
-   *
+   * 
    * @param r
    *          The Reducer to use
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withReducer(Reducer<K1, V1, K2, V2> r) {
+  public ReduceDriver<K1, V1, K2, V2> withReducer(
+      final Reducer<K1, V1, K2, V2> r) {
     setReducer(r);
     return this;
   }
@@ -89,8 +90,11 @@ public class ReduceDriver<K1, V1, K2, V2
     return counters;
   }
 
-  /** Sets the counters object to use for this test.
-   * @param ctrs The counters object to use.
+  /**
+   * Sets the counters object to use for this test.
+   * 
+   * @param ctrs
+   *          The counters object to use.
    */
   public void setCounters(final Counters ctrs) {
     this.counters = ctrs;
@@ -104,93 +108,98 @@ public class ReduceDriver<K1, V1, K2, V2
 
   /**
    * Identical to setInputKey() but with fluent programming style
-   *
+   * 
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withInputKey(K1 key) {
+  public ReduceDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
     setInputKey(key);
     return this;
   }
 
   /**
    * Identical to addInputValue() but with fluent programming style
-   *
+   * 
    * @param val
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withInputValue(V1 val) {
+  public ReduceDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
     addInputValue(val);
     return this;
   }
 
   /**
    * Identical to addInputValues() but with fluent programming style
-   *
+   * 
    * @param values
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withInputValues(List<V1> values) {
+  public ReduceDriver<K1, V1, K2, V2> withInputValues(final List<V1> values) {
     addInputValues(values);
     return this;
   }
 
   /**
    * Identical to setInput() but returns self for fluent programming style
-   *
+   * 
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withInput(K1 key, List<V1> values) {
+  public ReduceDriver<K1, V1, K2, V2> withInput(final K1 key,
+      final List<V1> values) {
     setInput(key, values);
     return this;
   }
 
   /**
    * Works like addOutput(), but returns self for fluent style
-   *
+   * 
    * @param outputRecord
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withOutput(Pair<K2, V2> outputRecord) {
+  public ReduceDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
     addOutput(outputRecord);
     return this;
   }
 
   /**
    * Works like addOutput(), but returns self for fluent style
-   *
-   * @param key The key part of a (k, v) pair to add
-   * @param val The val part of a (k, v) pair to add
+   * 
+   * @param key
+   *          The key part of a (k, v) pair to add
+   * @param val
+   *          The val part of a (k, v) pair to add
    * @return this
    */
-  public ReduceDriver<K1, V1, K2, V2> withOutput(K2 key, V2 val) {
+  public ReduceDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
     addOutput(key, val);
     return this;
   }
 
   /**
    * Identical to setInput, but with a fluent programming style
-   *
+   * 
    * @param input
    *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public ReduceDriver<K1, V1, K2, V2> withInputFromString(String input) {
+  public ReduceDriver<K1, V1, K2, V2> withInputFromString(final String input) {
     setInputFromString(input);
     return this;
   }
 
   /**
    * Identical to addOutput, but with a fluent programming style
-   *
+   * 
    * @param output
    *          A string of the form "key \t val". Trims any whitespace.
    * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility with non Text Writables
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
    */
   @Deprecated
-  public ReduceDriver<K1, V1, K2, V2> withOutputFromString(String output) {
+  public ReduceDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
     addOutputFromString(output);
     return this;
   }
@@ -201,16 +210,16 @@ public class ReduceDriver<K1, V1, K2, V2
       throw new IllegalStateException("No Reducer class was provided");
     }
 
-    List<Pair<K1, List<V1>>> inputs = new ArrayList<Pair<K1, List<V1>>>();
+    final List<Pair<K1, List<V1>>> inputs = new ArrayList<Pair<K1, List<V1>>>();
     inputs.add(new Pair<K1, List<V1>>(inputKey, getInputValues()));
 
     try {
-      MockReduceContextWrapper<K1, V1, K2, V2> wrapper = 
-        new MockReduceContextWrapper<K1, V1, K2, V2>(inputs, getCounters(), getConfiguration());
-      Reducer<K1, V1, K2, V2>.Context context = wrapper.getMockContext();
+      final MockReduceContextWrapper<K1, V1, K2, V2> wrapper = new MockReduceContextWrapper<K1, V1, K2, V2>(
+          inputs, getCounters(), getConfiguration());
+      final Reducer<K1, V1, K2, V2>.Context context = wrapper.getMockContext();
       myReducer.run(context);
       return wrapper.getOutputs();
-    } catch (InterruptedException ie) {
+    } catch (final InterruptedException ie) {
       throw new IOException(ie);
     }
   }
@@ -219,38 +228,40 @@ public class ReduceDriver<K1, V1, K2, V2
   public String toString() {
     return "ReduceDriver (0.20+) (" + myReducer + ")";
   }
-  
-  /** 
-   * @param configuration The configuration object that will given to the 
-   *        reducer associated with the driver
+
+  /**
+   * @param configuration
+   *          The configuration object that will given to the reducer associated
+   *          with the driver
    * @return this object for fluent coding
    */
   public ReduceDriver<K1, V1, K2, V2> withConfiguration(
-      Configuration configuration) {
+      final Configuration configuration) {
     setConfiguration(configuration);
     return this;
   }
+
   /**
-   * Returns a new ReduceDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new ReduceDriver without having to specify the generic types on
+   * the right hand side of the object create statement.
    * 
    * @return new ReduceDriver
    */
-  public static <K1, V1, K2, V2>  ReduceDriver<K1, V1, K2, V2> newReduceDriver() {
+  public static <K1, V1, K2, V2> ReduceDriver<K1, V1, K2, V2> newReduceDriver() {
     return new ReduceDriver<K1, V1, K2, V2>();
   }
+
   /**
-   * Returns a new ReduceDriver without having to specify
-   * the generic types on the right hand side of the object create
-   * statement.
+   * Returns a new ReduceDriver without having to specify the generic types on
+   * the right hand side of the object create statement.
    * 
    * 
-   * @param reducer passed to ReduceDriver constructor
+   * @param reducer
+   *          passed to ReduceDriver constructor
    * @return new ReduceDriver
    */
-  public static <K1, V1, K2, V2>  ReduceDriver<K1, V1, K2, V2> newReduceDriver(Reducer<K1, V1, K2, V2> reducer) {
+  public static <K1, V1, K2, V2> ReduceDriver<K1, V1, K2, V2> newReduceDriver(
+      final Reducer<K1, V1, K2, V2> reducer) {
     return new ReduceDriver<K1, V1, K2, V2>(reducer);
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockContextWrapper.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockContextWrapper.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockContextWrapper.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockContextWrapper.java Wed Mar 14 01:43:51 2012
@@ -41,40 +41,44 @@ public abstract class MockContextWrapper
   protected final Configuration conf;
   protected final List<Pair<KEYOUT, VALUEOUT>> outputs = new ArrayList<Pair<KEYOUT, VALUEOUT>>();
 
-  public MockContextWrapper(Counters counters, Configuration conf) {
+  public MockContextWrapper(final Counters counters, final Configuration conf) {
     this.conf = conf;
     this.counters = counters;
   }
-  
+
   @SuppressWarnings({ "rawtypes", "unchecked" })
-  protected void createCommon(TaskInputOutputContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT> context) throws IOException, InterruptedException {
-    when(context.getCounter((Enum)any())).thenAnswer(new Answer<Counter>() {
-      @Override
-      public Counter answer(InvocationOnMock invocation) {
-        Object[] args = invocation.getArguments();
-        return counters.findCounter((Enum)args[0]);
-      }
-    });
-    when(context.getCounter(anyString(), anyString())).thenAnswer(new Answer<Counter>() {
+  protected void createCommon(
+      final TaskInputOutputContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT> context)
+      throws IOException, InterruptedException {
+    when(context.getCounter((Enum) any())).thenAnswer(new Answer<Counter>() {
       @Override
-      public Counter answer(InvocationOnMock invocation) {
-        Object[] args = invocation.getArguments();
-        return counters.findCounter((String)args[0], (String)args[1]);
+      public Counter answer(final InvocationOnMock invocation) {
+        final Object[] args = invocation.getArguments();
+        return counters.findCounter((Enum) args[0]);
       }
     });
+    when(context.getCounter(anyString(), anyString())).thenAnswer(
+        new Answer<Counter>() {
+          @Override
+          public Counter answer(final InvocationOnMock invocation) {
+            final Object[] args = invocation.getArguments();
+            return counters.findCounter((String) args[0], (String) args[1]);
+          }
+        });
     when(context.getConfiguration()).thenAnswer(new Answer<Configuration>() {
       @Override
-      public Configuration answer(InvocationOnMock invocation) {
+      public Configuration answer(final InvocationOnMock invocation) {
         return conf;
       }
     });
     doAnswer(new Answer<Object>() {
-      public Object answer(InvocationOnMock invocation) {
-          Object[] args = invocation.getArguments();
-          outputs.add(new Pair(copy(args[0], conf), copy(args[1], conf)));
-          return null;
-      }}).when(context).write((KEYOUT)any(), (VALUEOUT)any());
+      @Override
+      public Object answer(final InvocationOnMock invocation) {
+        final Object[] args = invocation.getArguments();
+        outputs.add(new Pair(copy(args[0], conf), copy(args[1], conf)));
+        return null;
+      }
+    }).when(context).write((KEYOUT) any(), (VALUEOUT) any());
 
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockInputSplit.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockInputSplit.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockInputSplit.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockInputSplit.java Wed Mar 14 01:43:51 2012
@@ -29,9 +29,10 @@ public class MockInputSplit extends File
   private static final Path MOCK_PATH = new Path("somefile");
 
   public MockInputSplit() {
-    super(MOCK_PATH, 0, 0, (String []) null);
+    super(MOCK_PATH, 0, 0, (String[]) null);
   }
 
+  @Override
   public String toString() {
     return "MockInputSplit";
   }
@@ -43,4 +44,3 @@ public class MockInputSplit extends File
     return MOCK_PATH;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockMapContextWrapper.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockMapContextWrapper.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockMapContextWrapper.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockMapContextWrapper.java Wed Mar 14 01:43:51 2012
@@ -34,44 +34,46 @@ import org.mockito.invocation.Invocation
 import org.mockito.stubbing.Answer;
 
 /**
- * o.a.h.mapreduce.Mapper.map() expects to use a Mapper.Context
- * object as a parameter. We want to override the functionality
- * of a lot of Context to have it send the results back to us, etc.
- * But since Mapper.Context is an inner class of Mapper, we need to
- * put any subclasses of Mapper.Context in a subclass of Mapper.
- *
+ * o.a.h.mapreduce.Mapper.map() expects to use a Mapper.Context object as a
+ * parameter. We want to override the functionality of a lot of Context to have
+ * it send the results back to us, etc. But since Mapper.Context is an inner
+ * class of Mapper, we need to put any subclasses of Mapper.Context in a
+ * subclass of Mapper.
+ * 
  * This wrapper class exists for that purpose.
  */
-public class MockMapContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>
-    extends MockContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
+public class MockMapContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> extends
+    MockContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
 
-  protected static final Log LOG = LogFactory.getLog(MockMapContextWrapper.class);
+  protected static final Log LOG = LogFactory
+      .getLog(MockMapContextWrapper.class);
   protected final List<Pair<KEYIN, VALUEIN>> inputs;
   protected Pair<KEYIN, VALUEIN> currentKeyValue;
-  protected final Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context;  
+  protected final Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context;
 
-  public MockMapContextWrapper(List<Pair<KEYIN, VALUEIN>> inputs,
-      Counters counters, Configuration conf) throws IOException, InterruptedException {
+  public MockMapContextWrapper(final List<Pair<KEYIN, VALUEIN>> inputs,
+      final Counters counters, final Configuration conf) throws IOException,
+      InterruptedException {
     super(counters, conf);
     this.inputs = inputs;
     this.context = create();
   }
-  
-  @SuppressWarnings({ "unchecked"})
-  private Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create() 
-  throws IOException, InterruptedException {
-    Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context =  mock(org.apache.hadoop.mapreduce.Mapper.Context.class);
-    
+
+  @SuppressWarnings({ "unchecked" })
+  private Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create()
+      throws IOException, InterruptedException {
+    final Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Mapper.Context.class);
+
     createCommon(context);
-    
+
     /*
-     * In actual context code nextKeyValue() modifies 
-     * the current state so we can here as well.
+     * In actual context code nextKeyValue() modifies the current state so we
+     * can here as well.
      */
     when(context.nextKeyValue()).thenAnswer(new Answer<Boolean>() {
       @Override
-      public Boolean answer(InvocationOnMock invocation) {
-        if(inputs.size() > 0) {
+      public Boolean answer(final InvocationOnMock invocation) {
+        if (inputs.size() > 0) {
           currentKeyValue = inputs.remove(0);
           return true;
         } else {
@@ -82,22 +84,21 @@ public class MockMapContextWrapper<KEYIN
     });
     when(context.getCurrentKey()).thenAnswer(new Answer<KEYIN>() {
       @Override
-      public KEYIN answer(InvocationOnMock invocation) {
+      public KEYIN answer(final InvocationOnMock invocation) {
         return currentKeyValue.getFirst();
       }
     });
     when(context.getCurrentValue()).thenAnswer(new Answer<VALUEIN>() {
       @Override
-      public VALUEIN answer(InvocationOnMock invocation) {
+      public VALUEIN answer(final InvocationOnMock invocation) {
         return currentKeyValue.getSecond();
       }
-    });    
+    });
     return context;
   }
 
   /**
-   * @return the outputs from the MockOutputCollector back to
-   * the test harness.
+   * @return the outputs from the MockOutputCollector back to the test harness.
    */
   public List<Pair<KEYOUT, VALUEOUT>> getOutputs() {
     return outputs;

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockOutputCommitter.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockOutputCommitter.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockOutputCommitter.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockOutputCommitter.java Wed Mar 14 01:43:51 2012
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.mrunit.mapreduce.mock;
 
-import org.apache.hadoop.mapreduce.OutputCommitter;
 import org.apache.hadoop.mapreduce.JobContext;
+import org.apache.hadoop.mapreduce.OutputCommitter;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 
 /**
@@ -27,23 +27,28 @@ import org.apache.hadoop.mapreduce.TaskA
  */
 public class MockOutputCommitter extends OutputCommitter {
 
-  public void setupJob(JobContext jobContext) {
+  @Override
+  public void setupJob(final JobContext jobContext) {
   }
 
-  public void cleanupJob(JobContext jobContext) {
+  @Override
+  public void cleanupJob(final JobContext jobContext) {
   }
 
-  public void setupTask(TaskAttemptContext taskContext) {
+  @Override
+  public void setupTask(final TaskAttemptContext taskContext) {
   }
 
-  public boolean needsTaskCommit(TaskAttemptContext taskContext) {
+  @Override
+  public boolean needsTaskCommit(final TaskAttemptContext taskContext) {
     return false;
   }
 
-  public void commitTask(TaskAttemptContext taskContext) {
+  @Override
+  public void commitTask(final TaskAttemptContext taskContext) {
   }
 
-  public void abortTask(TaskAttemptContext taskContext) {
+  @Override
+  public void abortTask(final TaskAttemptContext taskContext) {
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockRawKeyValueIterator.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockRawKeyValueIterator.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockRawKeyValueIterator.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockRawKeyValueIterator.java Wed Mar 14 01:43:51 2012
@@ -19,30 +19,34 @@
 package org.apache.hadoop.mrunit.mapreduce.mock;
 
 import org.apache.hadoop.io.DataInputBuffer;
-import org.apache.hadoop.util.Progress;
 import org.apache.hadoop.mapred.RawKeyValueIterator;
+import org.apache.hadoop.util.Progress;
 
 /**
  * Mock implementation of RawKeyValueIterator that does nothing.
  */
 public class MockRawKeyValueIterator implements RawKeyValueIterator {
+  @Override
   public DataInputBuffer getKey() {
     return null;
   }
 
+  @Override
   public DataInputBuffer getValue() {
     return null;
   }
 
+  @Override
   public boolean next() {
     return false;
   }
 
+  @Override
   public void close() {
   }
 
+  @Override
   public Progress getProgress() {
     return null;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReduceContextWrapper.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReduceContextWrapper.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReduceContextWrapper.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReduceContextWrapper.java Wed Mar 14 01:43:51 2012
@@ -35,44 +35,45 @@ import org.mockito.invocation.Invocation
 import org.mockito.stubbing.Answer;
 
 /**
- * o.a.h.mapreduce.Reducer.reduce() expects to use a Reducer.Context
- * object as a parameter. We want to override the functionality
- * of a lot of Context to have it send the results back to us, etc.
- * But since Reducer.Context is an inner class of Reducer, we need to
- * put any subclasses of Reducer.Context in a subclass of Reducer.
- *
+ * o.a.h.mapreduce.Reducer.reduce() expects to use a Reducer.Context object as a
+ * parameter. We want to override the functionality of a lot of Context to have
+ * it send the results back to us, etc. But since Reducer.Context is an inner
+ * class of Reducer, we need to put any subclasses of Reducer.Context in a
+ * subclass of Reducer.
+ * 
  * This wrapper class exists for that purpose.
  */
-public class MockReduceContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> 
-extends MockContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
+public class MockReduceContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> extends
+    MockContextWrapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {
 
-  protected static final Log LOG = LogFactory.getLog(MockReduceContextWrapper.class);
+  protected static final Log LOG = LogFactory
+      .getLog(MockReduceContextWrapper.class);
   protected final List<Pair<KEYIN, List<VALUEIN>>> inputs;
   protected Pair<KEYIN, List<VALUEIN>> currentKeyValue;
   protected final Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context;
 
-  public MockReduceContextWrapper(List<Pair<KEYIN, List<VALUEIN>>> inputs,
-      Counters counters, Configuration conf) throws IOException, InterruptedException {
+  public MockReduceContextWrapper(
+      final List<Pair<KEYIN, List<VALUEIN>>> inputs, final Counters counters,
+      final Configuration conf) throws IOException, InterruptedException {
     super(counters, conf);
     this.inputs = inputs;
     this.context = create();
   }
-  
-  
-  @SuppressWarnings({ "unchecked"})
-  private Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create() 
-  throws IOException, InterruptedException {
-        
-    Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context =  mock(org.apache.hadoop.mapreduce.Reducer.Context.class);
+
+  @SuppressWarnings({ "unchecked" })
+  private Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context create()
+      throws IOException, InterruptedException {
+
+    final Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context = mock(org.apache.hadoop.mapreduce.Reducer.Context.class);
     createCommon(context);
     /*
-     * In actual context code nextKeyValue() modifies 
-     * the current state so we can here as well.
+     * In actual context code nextKeyValue() modifies the current state so we
+     * can here as well.
      */
     when(context.nextKey()).thenAnswer(new Answer<Boolean>() {
       @Override
-      public Boolean answer(InvocationOnMock invocation) {
-        if(inputs.size() > 0) {
+      public Boolean answer(final InvocationOnMock invocation) {
+        if (inputs.size() > 0) {
           currentKeyValue = inputs.remove(0);
           return true;
         } else {
@@ -83,57 +84,60 @@ extends MockContextWrapper<KEYIN, VALUEI
     });
     when(context.getCurrentKey()).thenAnswer(new Answer<KEYIN>() {
       @Override
-      public KEYIN answer(InvocationOnMock invocation) {
+      public KEYIN answer(final InvocationOnMock invocation) {
         return currentKeyValue.getFirst();
       }
     });
     when(context.getValues()).thenAnswer(new Answer<Iterable<VALUEIN>>() {
       @Override
-      public Iterable<VALUEIN> answer(InvocationOnMock invocation) {
+      public Iterable<VALUEIN> answer(final InvocationOnMock invocation) {
         return makeOneUseIterator(currentKeyValue.getSecond().iterator());
       }
     });
     return context;
   }
-  
+
   /**
-   * @return the outputs from the MockOutputCollector back to
-   * the test harness.
+   * @return the outputs from the MockOutputCollector back to the test harness.
    */
   public List<Pair<KEYOUT, VALUEOUT>> getOutputs() {
     return outputs;
   }
-  
+
   protected static <V> Iterable<V> makeOneUseIterator(final Iterator<V> parent) {
     return new Iterable<V>() {
-      private Iterator<V> iter = new Iterator<V>() {
+      private final Iterator<V> iter = new Iterator<V>() {
         private boolean used;
+
         @Override
         public boolean hasNext() {
-          if(used) {
+          if (used) {
             return false;
           }
           return parent.hasNext();
         }
+
         @Override
         public V next() {
-          if(used) {
+          if (used) {
             throw new IllegalStateException();
           }
           return parent.next();
         }
+
         @Override
         public void remove() {
           throw new IllegalStateException();
-        }        
+        }
       };
+
       @Override
       public Iterator<V> iterator() {
         return iter;
       }
     };
   }
-  
+
   public Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context getMockContext() {
     return context;
   }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReporter.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReporter.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReporter.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/mock/MockReporter.java Wed Mar 14 01:43:51 2012
@@ -23,14 +23,14 @@ import org.apache.hadoop.mapreduce.Statu
 
 public class MockReporter extends StatusReporter {
 
-  private Counters counters;
+  private final Counters counters;
 
   public MockReporter(final Counters ctrs) {
-    this.counters = ctrs;
+    counters = ctrs;
   }
 
   @Override
-  public void setStatus(String status) {
+  public void setStatus(final String status) {
     // do nothing.
   }
 
@@ -40,7 +40,7 @@ public class MockReporter extends Status
   }
 
   @Override
-  public Counter getCounter(String group, String name) {
+  public Counter getCounter(final String group, final String name) {
     Counter counter = null;
     if (counters != null) {
       counter = counters.findCounter(group, name);
@@ -50,7 +50,7 @@ public class MockReporter extends Status
   }
 
   @Override
-  public Counter getCounter(Enum<?> key) {
+  public Counter getCounter(final Enum<?> key) {
     Counter counter = null;
     if (counters != null) {
       counter = counters.findCounter(key);
@@ -58,9 +58,8 @@ public class MockReporter extends Status
 
     return counter;
   }
-  
+
   public float getProgress() {
     return 0;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockInputSplit.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockInputSplit.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockInputSplit.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockInputSplit.java Wed Mar 14 01:43:51 2012
@@ -35,7 +35,7 @@ public class MockInputSplit extends File
   private static final Path MOCK_PATH = new Path("somefile");
 
   public MockInputSplit() {
-    super(MOCK_PATH, 0, 0, (String []) null);
+    super(MOCK_PATH, 0, 0, (String[]) null);
   }
 
   @Override
@@ -49,18 +49,18 @@ public class MockInputSplit extends File
   }
 
   @Override
-  public void readFields(DataInput in) throws IOException {
+  public void readFields(final DataInput in) throws IOException {
   }
 
   @Override
-  public void write(DataOutput out) throws IOException {
+  public void write(final DataOutput out) throws IOException {
   }
 
+  @Override
   public String toString() {
     return "MockInputSplit";
   }
 
-
   /**
    * Return the path object represented by this as a FileSplit.
    */
@@ -68,4 +68,3 @@ public class MockInputSplit extends File
     return MOCK_PATH;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockOutputCollector.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockOutputCollector.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockOutputCollector.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockOutputCollector.java Wed Mar 14 01:43:51 2012
@@ -17,47 +17,42 @@
  */
 package org.apache.hadoop.mrunit.mock;
 
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.DataInputBuffer;
-import org.apache.hadoop.io.DataOutputBuffer;
-import org.apache.hadoop.io.serializer.SerializationFactory;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mrunit.Serialization;
 import org.apache.hadoop.mrunit.types.Pair;
 
-
 /**
- * OutputCollector to use in the test framework for Mapper and Reducer
- * classes. Accepts a set of output (k, v) pairs and returns them to the
- * framework for validation.
+ * OutputCollector to use in the test framework for Mapper and Reducer classes.
+ * Accepts a set of output (k, v) pairs and returns them to the framework for
+ * validation.
  */
 public class MockOutputCollector<K, V> implements OutputCollector<K, V> {
 
-  private ArrayList<Pair<K, V>> collectedOutputs;
-  private Configuration conf;
-
+  private final ArrayList<Pair<K, V>> collectedOutputs;
+  private final Configuration conf;
 
-  public MockOutputCollector(Configuration config) {
+  public MockOutputCollector(final Configuration config) {
     collectedOutputs = new ArrayList<Pair<K, V>>();
     conf = config;
   }
 
-
-  private Object deepCopy(Object obj) {
-      return Serialization.copy(obj, conf);
+  private Object deepCopy(final Object obj) {
+    return Serialization.copy(obj, conf);
   }
 
   /**
    * Accepts another (key, value) pair as an output of this mapper/reducer.
    */
+  @Override
   @SuppressWarnings("unchecked")
-  public void collect(K key, V value) throws IOException {
-    collectedOutputs.add(new Pair<K, V>((K) deepCopy(key), (V) deepCopy(value)));
+  public void collect(final K key, final V value) throws IOException {
+    collectedOutputs
+        .add(new Pair<K, V>((K) deepCopy(key), (V) deepCopy(value)));
   }
 
   /**
@@ -67,4 +62,3 @@ public class MockOutputCollector<K, V> i
     return collectedOutputs;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockReporter.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockReporter.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockReporter.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mock/MockReporter.java Wed Mar 14 01:43:51 2012
@@ -18,54 +18,54 @@
 package org.apache.hadoop.mrunit.mock;
 
 import org.apache.hadoop.mapred.Counters;
+import org.apache.hadoop.mapred.Counters.Counter;
 import org.apache.hadoop.mapred.InputSplit;
 import org.apache.hadoop.mapred.Reporter;
-import org.apache.hadoop.mapred.Counters.Counter;
 
 @SuppressWarnings("deprecation")
 public class MockReporter implements Reporter {
 
-  private MockInputSplit inputSplit = new MockInputSplit();
-  private Counters counters;
+  private final MockInputSplit inputSplit = new MockInputSplit();
+  private final Counters counters;
 
   public enum ReporterType {
-    Mapper,
-    Reducer
+    Mapper, Reducer
   }
 
-  private ReporterType typ;
+  private final ReporterType typ;
 
   public MockReporter(final ReporterType kind, final Counters ctrs) {
-    this.typ = kind;
-    this.counters = ctrs;
+    typ = kind;
+    counters = ctrs;
   }
 
   @Override
   public InputSplit getInputSplit() {
     if (typ == ReporterType.Reducer) {
       throw new UnsupportedOperationException(
-              "Reducer cannot call getInputSplit()");
+          "Reducer cannot call getInputSplit()");
     } else {
       return inputSplit;
     }
   }
 
   @Override
-  public void incrCounter(Enum<?> key, long amount) {
+  public void incrCounter(final Enum<?> key, final long amount) {
     if (null != counters) {
       counters.incrCounter(key, amount);
     }
   }
 
   @Override
-  public void incrCounter(String group, String counter, long amount) {
+  public void incrCounter(final String group, final String counter,
+      final long amount) {
     if (null != counters) {
       counters.incrCounter(group, counter, amount);
     }
   }
 
   @Override
-  public void setStatus(String status) {
+  public void setStatus(final String status) {
     // do nothing.
   }
 
@@ -75,7 +75,7 @@ public class MockReporter implements Rep
   }
 
   @Override
-  public Counter getCounter(String group, String name) {
+  public Counter getCounter(final String group, final String name) {
     Counters.Counter counter = null;
     if (counters != null) {
       counter = counters.findCounter(group, name);
@@ -85,7 +85,7 @@ public class MockReporter implements Rep
   }
 
   @Override
-  public Counter getCounter(Enum<?> key) {
+  public Counter getCounter(final Enum<?> key) {
     Counters.Counter counter = null;
     if (counters != null) {
       counter = counters.findCounter(key);
@@ -93,8 +93,8 @@ public class MockReporter implements Rep
 
     return counter;
   }
+
   public float getProgress() {
     return 0;
   }
 }
-

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/testutil/ExtendedAssert.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/testutil/ExtendedAssert.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/testutil/ExtendedAssert.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/testutil/ExtendedAssert.java Wed Mar 14 01:43:51 2012
@@ -17,34 +17,42 @@
  */
 package org.apache.hadoop.mrunit.testutil;
 
-import java.util.List;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-import static org.junit.Assert.*;
+import java.util.List;
 
 public final class ExtendedAssert {
 
-  private ExtendedAssert() { }
+  private ExtendedAssert() {
+  }
 
   /**
    * Asserts that all the elements of the list are equivalent under equals()
-   * @param expected a list full of expected values
-   * @param actual a list full of actual test values
+   * 
+   * @param expected
+   *          a list full of expected values
+   * @param actual
+   *          a list full of actual test values
    */
-  public static void assertListEquals(List<?> expected, List<?> actual) {
+  public static void assertListEquals(final List<?> expected,
+      final List<?> actual) {
     if (expected.size() != actual.size()) {
       fail("Expected list of size " + expected.size() + "; actual size is "
           + actual.size());
     }
 
     for (int i = 0; i < expected.size(); i++) {
-      Object t1 = expected.get(i);
-      Object t2 = actual.get(i);
+      final Object t1 = expected.get(i);
+      final Object t2 = actual.get(i);
 
-      boolean same = (t1 == t2) || (t1 != null && t1.equals(t2)) || (t2 != null && t2.equals(t1));
+      final boolean same = (t1 == t2) || (t1 != null && t1.equals(t2))
+          || (t2 != null && t2.equals(t1));
       if (!same) {
-        fail("Expected element " + t1 + " (" + ((t2 == null) ? "unknown type" : t2.getClass().getName()) + 
-            ") at index " + i + " != actual element " + t2 + 
-            " (" + ((t2 == null) ? "unknown type" : t2.getClass().getName()) + ")");
+        fail("Expected element " + t1 + " ("
+            + ((t2 == null) ? "unknown type" : t2.getClass().getName())
+            + ") at index " + i + " != actual element " + t2 + " ("
+            + ((t2 == null) ? "unknown type" : t2.getClass().getName()) + ")");
       }
     }
   }
@@ -52,24 +60,24 @@ public final class ExtendedAssert {
   /**
    * asserts x &gt; y
    */
-  public static void assertGreater(int x, int y) {
+  public static void assertGreater(final int x, final int y) {
     assertTrue("Expected " + x + " > " + y, x > y);
   }
 
   /** asserts x &gt;= y) */
-  public static void assertGreaterOrEqual(int x, int y) {
+  public static void assertGreaterOrEqual(final int x, final int y) {
     assertTrue("Expected " + x + " >= " + y, x >= y);
   }
 
   /**
    * asserts x &lt; y
    */
-  public static void assertLess(int x, int y) {
+  public static void assertLess(final int x, final int y) {
     assertTrue("Expected " + x + " < " + y, x < y);
   }
 
   /** asserts x &gt;= y) */
-  public static void assertLessOrEqual(int x, int y) {
+  public static void assertLessOrEqual(final int x, final int y) {
     assertTrue("Expected " + x + " <= " + y, x <= y);
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/types/Pair.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/types/Pair.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/types/Pair.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/types/Pair.java Wed Mar 14 01:43:51 2012
@@ -19,7 +19,6 @@ package org.apache.hadoop.mrunit.types;
 
 import java.util.Comparator;
 
-
 /**
  * A very basic pair type.
  */
@@ -34,15 +33,20 @@ public class Pair<S, T> implements Compa
     second = cdr;
   }
 
-  public S getFirst() { return first; }
-  public T getSecond() { return second; }
+  public S getFirst() {
+    return first;
+  }
+
+  public T getSecond() {
+    return second;
+  }
 
   @Override
-  public boolean equals(Object o) {
+  public boolean equals(final Object o) {
     if (null == o) {
       return false;
     } else if (o instanceof Pair) {
-      Pair<S, T> p = (Pair<S, T>) o;
+      final Pair<S, T> p = (Pair<S, T>) o;
       if (first == null && second == null) {
         return p.first == null && p.second == null;
       } else if (first == null) {
@@ -73,16 +77,16 @@ public class Pair<S, T> implements Compa
   }
 
   @Override
-  public int compareTo(Pair<S, T> p) {
+  public int compareTo(final Pair<S, T> p) {
     if (null == p) {
       return 1;
     }
 
-    Comparable<S> firstCompare = (Comparable<S>) first;
+    final Comparable<S> firstCompare = (Comparable<S>) first;
 
-    int firstResult = firstCompare.compareTo(p.first);
+    final int firstResult = firstCompare.compareTo(p.first);
     if (firstResult == 0) {
-      Comparable<T> secondCompare = (Comparable<T>) second;
+      final Comparable<T> secondCompare = (Comparable<T>) second;
       return secondCompare.compareTo(p.second);
     } else {
       return firstResult;
@@ -94,8 +98,9 @@ public class Pair<S, T> implements Compa
     public FirstElemComparator() {
     }
 
-    public int compare(Pair<S, T> p1, Pair<S, T> p2) {
-      Comparable<S> cS = (Comparable<S>) p1.first;
+    @Override
+    public int compare(final Pair<S, T> p1, final Pair<S, T> p2) {
+      final Comparable<S> cS = (Comparable<S>) p1.first;
       return cS.compareTo(p2.first);
     }
   }
@@ -104,8 +109,9 @@ public class Pair<S, T> implements Compa
     public SecondElemComparator() {
     }
 
-    public int compare(Pair<S, T> p1, Pair<S, T> p2) {
-      Comparable<T> cT = (Comparable<T>) p1.second;
+    @Override
+    public int compare(final Pair<S, T> p1, final Pair<S, T> p2) {
+      final Comparable<T> cT = (Comparable<T>) p1.second;
       return cT.compareTo(p2.second);
     }
   }

Modified: incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/ExpectedSuppliedException.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/ExpectedSuppliedException.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/ExpectedSuppliedException.java (original)
+++ incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/ExpectedSuppliedException.java Wed Mar 14 01:43:51 2012
@@ -17,8 +17,6 @@
  */
 package org.apache.hadoop.mrunit;
 
-import junit.framework.AssertionFailedError;
-
 import org.hamcrest.Matcher;
 import org.junit.rules.ExpectedException;
 import org.junit.rules.MethodRule;

Modified: incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/TestConfigureClose.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/TestConfigureClose.java?rev=1300437&r1=1300436&r2=1300437&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/TestConfigureClose.java (original)
+++ incubator/mrunit/trunk/src/test/java/org/apache/hadoop/mrunit/TestConfigureClose.java Wed Mar 14 01:43:51 2012
@@ -17,7 +17,7 @@
  */
 package org.apache.hadoop.mrunit;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Iterator;
@@ -38,9 +38,9 @@ public class TestConfigureClose {
   public void testMapperConfigureClose() {
     final AtomicBoolean configureWasCalled = new AtomicBoolean(false);
     final AtomicBoolean closeWasCalled = new AtomicBoolean(false);
-    Mapper<Text, Text, Text, Text> mapper = new Mapper<Text, Text, Text, Text>() {
+    final Mapper<Text, Text, Text, Text> mapper = new Mapper<Text, Text, Text, Text>() {
       @Override
-      public void configure(JobConf arg0) {
+      public void configure(final JobConf arg0) {
         configureWasCalled.set(true);
       }
 
@@ -48,23 +48,27 @@ public class TestConfigureClose {
       public void close() throws IOException {
         closeWasCalled.set(true);
       }
+
       @Override
-      public void map(Text key, Text value, OutputCollector<Text, Text> output,
-          Reporter reporter) throws IOException { 
-      }
-    };    
-    MapDriver<Text, Text, Text, Text> driver = MapDriver.newMapDriver(mapper);
+      public void map(final Text key, final Text value,
+          final OutputCollector<Text, Text> output, final Reporter reporter)
+          throws IOException {
+      }
+    };
+    final MapDriver<Text, Text, Text, Text> driver = MapDriver
+        .newMapDriver(mapper);
     driver.runTest();
     assertTrue(configureWasCalled.get());
     assertTrue(closeWasCalled.get());
   }
+
   @Test
   public void testReducerConfigureClose() {
     final AtomicBoolean configureWasCalled = new AtomicBoolean(false);
     final AtomicBoolean closeWasCalled = new AtomicBoolean(false);
-    Reducer<Text, Text, Text, Text> reducer = new Reducer<Text, Text, Text, Text>() {
+    final Reducer<Text, Text, Text, Text> reducer = new Reducer<Text, Text, Text, Text>() {
       @Override
-      public void configure(JobConf arg0) {
+      public void configure(final JobConf arg0) {
         configureWasCalled.set(true);
       }
 
@@ -74,11 +78,13 @@ public class TestConfigureClose {
       }
 
       @Override
-      public void reduce(Text arg0, Iterator<Text> arg1,
-          OutputCollector<Text, Text> arg2, Reporter arg3) throws IOException {
-      }
-    };    
-    ReduceDriver<Text, Text, Text, Text> driver = ReduceDriver.newReduceDriver(reducer);
+      public void reduce(final Text arg0, final Iterator<Text> arg1,
+          final OutputCollector<Text, Text> arg2, final Reporter arg3)
+          throws IOException {
+      }
+    };
+    final ReduceDriver<Text, Text, Text, Text> driver = ReduceDriver
+        .newReduceDriver(reducer);
     driver.runTest();
     assertTrue(configureWasCalled.get());
     assertTrue(closeWasCalled.get());