public void testTotalOrderMemCmp() throws Exception {
   TotalOrderPartitioner<Text, NullWritable> partitioner =
       new TotalOrderPartitioner<Text, NullWritable>();
   JobConf job = new JobConf();
   Path p =
       TestTotalOrderPartitioner.<Text>writePartitionFile("totalordermemcmp", job, splitStrings);
   job.setMapOutputKeyClass(Text.class);
   try {
     partitioner.configure(job);
     NullWritable nw = NullWritable.get();
     for (Check<Text> chk : testStrings) {
       assertEquals(
           chk.data.toString(),
           chk.part,
           partitioner.getPartition(chk.data, nw, splitStrings.length + 1));
     }
   } finally {
     p.getFileSystem(job).delete(p);
   }
 }
 public void testTotalOrderCustomComparator() throws Exception {
   TotalOrderPartitioner<Text, NullWritable> partitioner =
       new TotalOrderPartitioner<Text, NullWritable>();
   JobConf job = new JobConf();
   Text[] revSplitStrings = Arrays.copyOf(splitStrings, splitStrings.length);
   Arrays.sort(revSplitStrings, new ReverseStringComparator());
   Path p =
       TestTotalOrderPartitioner.<Text>writePartitionFile(
           "totalordercustomcomparator", job, revSplitStrings);
   job.setBoolean("total.order.partitioner.natural.order", false);
   job.setMapOutputKeyClass(Text.class);
   job.setOutputKeyComparatorClass(ReverseStringComparator.class);
   ArrayList<Check<Text>> revCheck = new ArrayList<Check<Text>>();
   revCheck.add(new Check<Text>(new Text("aaaaa"), 9));
   revCheck.add(new Check<Text>(new Text("aaabb"), 9));
   revCheck.add(new Check<Text>(new Text("aabbb"), 9));
   revCheck.add(new Check<Text>(new Text("aaaaa"), 9));
   revCheck.add(new Check<Text>(new Text("babbb"), 8));
   revCheck.add(new Check<Text>(new Text("baabb"), 8));
   revCheck.add(new Check<Text>(new Text("yai"), 1));
   revCheck.add(new Check<Text>(new Text("yak"), 1));
   revCheck.add(new Check<Text>(new Text("z"), 0));
   revCheck.add(new Check<Text>(new Text("ddngo"), 4));
   revCheck.add(new Check<Text>(new Text("hi"), 3));
   try {
     partitioner.configure(job);
     NullWritable nw = NullWritable.get();
     for (Check<Text> chk : revCheck) {
       assertEquals(
           chk.data.toString(),
           chk.part,
           partitioner.getPartition(chk.data, nw, splitStrings.length + 1));
     }
   } finally {
     p.getFileSystem(job).delete(p);
   }
 }