title: java.lang.NoSuchMethodError: org.apache.hadoop.mapreduce.TaskAttemptID while running MRUnit
body: <p>I'm trying to develop mr-job using Cloudera hadoop distrubution.I'm using api version 2.
  I do get trouble with mr-unit. Please advice what to do. I've used standard arhetype and completely lost, I don't get where is the rot of problem.
  Here are my dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;com.cloudera.hadoop&lt;/groupId&gt;
              &lt;artifactId&gt;hadoop-core&lt;/artifactId&gt;
              &lt;version&gt;0.20.2-320&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.cloudera.hadoop&lt;/groupId&gt;
              &lt;artifactId&gt;hadoop-mrunit&lt;/artifactId&gt;
              &lt;version&gt;0.20.2-320&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Here is my test code:</p>
  
  <pre><code>@Test
      public void testEmptyOutput() throws Exception{
          for(String line : linesFromFlatFile){
              //List&lt;Pair&lt;GetReq, IntWritable&gt;&gt; output = 
                      driver.withInput(UNUSED_LONG_KEY, new Text(line) )
                   // .withOutput(null, null )
                    .run();
              //assertTrue("", output.isEmpty());
          }
      }
  </code></pre>
  
  <p>And here is an exception:</p>
  
  <pre><code>&gt; Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.283
  &gt; sec &lt;&lt;&lt; FAILURE!
  &gt; testEmptyOutput(MapperTest)
  &gt; Time elapsed: 0.258 sec  &lt;&lt;&lt; ERROR! java.lang.NoSuchMethodError:
  &gt; org.apache.hadoop.mapreduce.TaskAttemptID.&lt;init&gt;(Ljava/lang/String;IZII)V
  &gt;   at
  &gt; org.apache.hadoop.mrunit.mapreduce.mock.MockMapContextWrapper$MockMapContext.&lt;init&gt;(MockMapContextWrapper.java:71)
  &gt;   at
  &gt; org.apache.hadoop.mrunit.mapreduce.mock.MockMapContextWrapper.getMockContext(MockMapContextWrapper.java:144)
  &gt;   at
  &gt; org.apache.hadoop.mrunit.mapreduce.MapDriver.run(MapDriver.java:197)
  &gt;   at
  MapperTest.testEmptyOutput(ScoringCounterMapperTest.java:42)
  
  package mypackage;
  
  import java.util.Date;
  import java.util.List;
  
  import junit.framework.TestCase;
  
  import org.apache.hadoop.io.IntWritable;
  import org.apache.hadoop.io.LongWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Mapper;
  import org.apache.hadoop.mrunit.mapreduce.MapDriver;
  import org.apache.hadoop.mrunit.types.Pair;
  import org.junit.Before;
  import org.junit.Test;
  
  import Sample;
  import GetReq;
  
  
  
  public class MapperTest extends TestCase {
      private static final IntWritable ONE_OCCURANCE = new IntWritable(1);
      private static final LongWritable UNUSED_LONG_KEY = new LongWritable(new Date().getTime());
  
      private Mapper&lt;LongWritable, Text, GetReq, IntWritable&gt; mapper;
      private MapDriver&lt;LongWritable, Text, GetReq, IntWritable&gt; driver;
  
      List&lt;String&gt; linesFromFlatFileNoOutput = null;
      List&lt;String&gt; linesFromFlatFileWithOutput = null;
      @Before 
      public void setUp() {
          mapper = newMapper();
          driver = new MapDriver&lt;LongWritable, Text, GetReq, IntWritable&gt;(mapper);
          Mapper.METADATA_CSV ="../../data/metadata.csv"; //ugly hook
          linesFromFlatFileNoOutput = Sample.instance.getLinesFromFlatFileNoOutput();  
          linesFromFlatFileWithOutput = Sample.instance.getLinesFromFlatFileWithOutput(); 
      }
  
      @Test
      public void testEmptyOutput() throws Exception{
          for(String line : linesFromFlatFileNoOutput){
              //List&lt;Pair&lt;GetReq, IntWritable&gt;&gt; output = 
                      driver.withInput(UNUSED_LONG_KEY, new Text(line) )
                    .withOutput(null, null )
                    .runTest();
              //assertTrue("", output.isEmpty());
          }
      }
  
      @Test
      public void testResultOutput() throws Exception{
          for(String line : linesFromFlatFileWithOutput){
              driver.withInput(UNUSED_LONG_KEY, new Text(line) )
                  //.withOutput(null, null )
                  .runTest();
          }
      }
  }
  </code></pre>
  
  <p>Hm... I didn't change anything in pom.xml
  Now I get output and the same exeption. Looks like mapper runs once. Or rties to run. I get debug output from mapper body.</p>
  
  <p><strong>UPD:</strong> I've added classifier and changed dependency:</p>
  
  <pre><code>&lt;dependency&gt;
                  &lt;groupId&gt;org.apache.mrunit&lt;/groupId&gt;
                  &lt;artifactId&gt;mrunit&lt;/artifactId&gt;
                  &lt;version&gt;0.9.0-incubating&lt;/version&gt;
                  &lt;classifier&gt;hadoop2&lt;/classifier&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
  </code></pre>
  
  <p>Now I do get another problem:</p>
  
  <blockquote>
    <p>Found interface org.apache.hadoop.mapreduce.Counter, but class was
    expected</p>
  </blockquote>
  
  <p>on line:</p>
  
  <pre><code>context.getCounter(EnumCounter.MATCHED_RECORDS).increment(1);
  </code></pre>
  
  <p>What do I do wrong again?</p>