### Question:
MultiTableRangePartitioner extends Partitioner<BulkIngestKey,Value> implements DelegatePartitioner { @Override public int getPartition(BulkIngestKey key, Value value, int numPartitions) { readCacheFilesIfNecessary(); String tableName = key.getTableName().toString(); Text[] cutPointArray = splitsByTable.get().get(tableName); if (null == cutPointArray) return (tableName.hashCode() & Integer.MAX_VALUE) % numPartitions; key.getKey().getRow(holder); int index = Arrays.binarySearch(cutPointArray, holder); index = calculateIndex(index, numPartitions, tableName, cutPointArray.length); index = partitionLimiter.limit(numPartitions, index); TaskInputOutputContext<?,?,?,?> c = context; if (c != null && collectStats) { c.getCounter("Partitions: " + key.getTableName(), "part." + formatter.format(index)).increment(1); } return index; }  @Override int getPartition(BulkIngestKey key, Value value, int numPartitions); static void setContext(TaskInputOutputContext<?,?,?,?> context); @Override void initializeJob(Job job); @Override void setConf(Configuration conf); @Override void configureWithPrefix(String prefix); @Override int getNumPartitions(); @Override Configuration getConf(); static final String PARTITION_STATS; }### Answer:
@Test public void testGoodSplitsFile() throws IOException, URISyntaxException { mockContextForLocalCacheFile(createUrl("trimmed_splits.txt")); Assert.assertEquals(5, getPartition()); }
@Test(expected = RuntimeException.class) public void testEmptySplitsThrowsException() throws IOException, URISyntaxException { mockContextForLocalCacheFile(createUrl("trimmed_empty_splits.txt")); getPartition(); }