### Question:
PartitionsAndStatistics { public ColumnStatistics getStatisticsForPartition(Partition partition) { if (partition == null) { throw new IllegalArgumentException("partition == null"); } return statisticsByPartition.get(partition); } PartitionsAndStatistics(
      List<FieldSchema> partitionKeys,
      List<Partition> partitions,
      Map<String, List<ColumnStatisticsObj>> statisticsByPartitionName);  PartitionsAndStatistics(
      List<FieldSchema> partitionKeys,
      Map<Partition, ColumnStatistics> statisticsByPartition); List<Partition> getPartitions(); List<FieldSchema> getPartitionKeys(); ColumnStatistics getStatisticsForPartition(Partition partition); List<String> getPartitionNames();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void getStatisticsForPartitionNullArgument() { List<FieldSchema> partitionKeys = Lists.newArrayList(newFieldSchema("a")); List<Partition> partitions = Lists.newArrayList(); PartitionsAndStatistics partitionsAndStatistics = new PartitionsAndStatistics(partitionKeys, partitions, statisticsPerPartitionName); partitionsAndStatistics.getStatisticsForPartition(null); }
@Test public void getStatisticsForPartitionReturnsNullIfNotPresent() throws Exception { List<FieldSchema> partitionKeys = Lists.newArrayList(newFieldSchema("a")); Table table = newTable("t1", "db1", partitionKeys, newStorageDescriptor(new File("bla"), "col1")); List<Partition> partitions = Lists.newArrayList(newPartition(table, "b")); PartitionsAndStatistics partitionsAndStatistics = new PartitionsAndStatistics(partitionKeys, partitions, statisticsPerPartitionName); assertNull(partitionsAndStatistics.getStatisticsForPartition(partitions.get(0))); }
@Test public void getStatisticsForPartitionReturnsNullIfEmptyStats() throws Exception { List<FieldSchema> partitionKeys = Lists.newArrayList(newFieldSchema("a")); Table table = newTable("t1", "db1", partitionKeys, newStorageDescriptor(new File("bla"), "col1")); List<Partition> partitions = Lists.newArrayList(newPartition(table, "b")); statisticsPerPartitionName.put("a=b", Collections.<ColumnStatisticsObj> emptyList()); PartitionsAndStatistics partitionsAndStatistics = new PartitionsAndStatistics(partitionKeys, partitions, statisticsPerPartitionName); assertNull(partitionsAndStatistics.getStatisticsForPartition(partitions.get(0))); }