### Question:
LimitedKeyPartitioner extends Partitioner<BulkIngestKey,Value> implements Configurable, DelegatePartitioner { @Override public void setConf(Configuration conf) { this.conf = conf; partitionLimiter = new PartitionLimiter(conf); }  @Override int getPartition(BulkIngestKey bKey, Value value, int numPartitions); @Override Configuration getConf(); @Override void setConf(Configuration conf); @Override void configureWithPrefix(String prefix); @Override int getNumPartitions(); @Override void initializeJob(Job job);  }### Answer:
@Test public void testLimitedRangeSetViaGenericConfig() throws IllegalAccessException, InstantiationException { Configuration conf = new Configuration(); conf.setInt(PartitionLimiter.MAX_PARTITIONS_PROPERTY, 8); LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.newInstance(); partitioner.setConf(conf); assertPartitionsUnderMax(partitioner, 8); }
@Test public void testHigherMaxThanReducers() throws IllegalAccessException, InstantiationException { Configuration conf = new Configuration(); conf.setInt(PartitionLimiter.MAX_PARTITIONS_PROPERTY, NUM_REDUCERS + 1); LimitedKeyPartitioner partitioner = LimitedKeyPartitioner.class.newInstance(); partitioner.setConf(conf); assertPartitionsUnderMax(partitioner, NUM_REDUCERS); }