### Question:
PartitionSpecCreatingDiffListener implements DiffListener { @Override public void onNewPartition(String partitionName, Partition partition) { addPartition(partition); } PartitionSpecCreatingDiffListener(Configuration conf); @Override void onDiffStart(TableAndMetadata source, Optional<TableAndMetadata> replica); @Override void onChangedTable(List<Diff<Object, Object>> differences); @Override void onNewPartition(String partitionName, Partition partition); @Override void onChangedPartition(String partitionName, Partition partition, List<Diff<Object, Object>> differences); @Override void onDataChanged(String partitionName, Partition partition); @Override void onDiffEnd(); String getPartitionSpecFilter();  }### Answer:
@Test public void onNewPartition() throws Exception { Partition partition1 = new Partition(Lists.newArrayList("val1", "val2"), DB, TABLE, 1, 1, null, null); Partition partition2 = new Partition(Lists.newArrayList("val11", "val22"), DB, TABLE, 1, 1, null, null); listener.onDiffStart(source, replica); listener.onNewPartition("p1", partition1); listener.onNewPartition("p2", partition2); assertThat(listener.getPartitionSpecFilter(), is("(p1='val1' AND p2=val2) OR (p1='val11' AND p2=val22)")); }