mrunit-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Bernico <>
Subject Help testing a reducer with MRUnit 1.0.0 Hadoop2
Date Wed, 24 Jul 2013 22:25:59 GMT
Hi Everyone,

I'm experiencing some odd behavior, that's likely my fault, with MRUnit.
 Would someone mind taking a look?   It seems like no matter what I do the
reducer test harness is just echoing back whatever I send to the reducer.
I made a really simple/dumb recreate of the issue here.

Many thanks in advance...

*import* org.apache.hadoop.mapreduce.Reducer;

*public* *class* TestReducer
                Reducer<IntWritable, IntWritable, IntWritable, IntWritable>

        *public* *void* Reduce(IntWritable key,
                        Iterable<IntWritable> values, Context context)
                        *throws* IOException, InterruptedException {

                *int* *i*;
                *for* (IntWritable value : values) {
                        i = value.get();
                context.write(*new* IntWritable(7), *new* IntWritable(11));


*import* java.util.ArrayList;
*import* java.util.List;

*import* org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
*import* org.junit.Test;

*public* *class* TestReducerTest {

        *public* *void* testReducer()
                        *throws* IOException, InterruptedException {

                List<IntWritable> theList = *new* ArrayList <IntWritable>();
                theList.add(*new* IntWritable(5));

                        .withReducer(*new* TestReducer())
                        .withInput(*new* IntWritable(1), theList)
                        .withOutput(*new* IntWritable(7), *new*



13/07/24 17:16:13 ERROR mrunit.TestDriver: Missing expected output (7, 11)
at position 0.
13/07/24 17:16:13 ERROR mrunit.TestDriver: Received unexpected output (1,
5) at position 0.

View raw message