Mapper<TestWritable, Text, TestWritable, Text> identityMapper = new Mapper<TestWritable, Text, TestWritable, Text>();
Mapper<TestWritable, Text, TestWritable, Text> anotherIdentityMapper = new Mapper<TestWritable, Text, TestWritable, Text>();
testDriver.addMapper(identityMapper);
testDriver.addMapper(anotherIdentityMapper);
testDriver
.withInput(identityMapper, new TestWritable("A1"), new Text("A1"))
.withInput(identityMapper, new TestWritable("A2"), new Text("A2"))
.withInput(identityMapper, new TestWritable("A3"), new Text("A3"))
.withInput(anotherIdentityMapper, new TestWritable("B1"),
new Text("B1"))
.withInput(anotherIdentityMapper, new TestWritable("B2"),
new Text("B2"))
.withKeyGroupingComparator(new TestWritable.SingleGroupComparator())
.withOutput(new TestWritable("B2"), new Text("B2"))
.withOutput(new TestWritable("B1"), new Text("B1"))
.withOutput(new TestWritable("A3"), new Text("A3"))
.withOutput(new TestWritable("A2"), new Text("A2"))
.withOutput(new TestWritable("A1"), new Text("A1")).runTest(true); // ordering
// is
// important
}