### Question:
SnsListener implements LocomotiveListener, SourceCatalogListener, ReplicaCatalogListener,
    TableReplicationListener, CopierListener { @VisibleForTesting static List<List<String>> getModifiedPartitions( List<EventPartition> partitionsToAlter, List<EventPartition> partitionsToCreate) { if (partitionsToAlter == null && partitionsToCreate == null) { return null; } List<List<String>> partitionValues = new ArrayList<>(); for (List<EventPartition> partitions : Arrays.asList(partitionsToAlter, partitionsToCreate)) { if (partitions != null) { for (EventPartition partition : partitions) { partitionValues.add(partition.getValues()); } } } return partitionValues; } @Autowired  SnsListener(AmazonSNSAsync sns, ListenerConfig config);   SnsListener(AmazonSNSAsync sns, ListenerConfig config, Clock clock); @Override void circusTrainStartUp(String[] args, EventSourceCatalog sourceCatalog, EventReplicaCatalog replicaCatalog); @Override void copierEnd(Metrics metrics); @Override void tableReplicationStart(EventTableReplication tableReplication, String eventId); @Override void tableReplicationSuccess(EventTableReplication tableReplication, String eventId); @Override void tableReplicationFailure(EventTableReplication tableReplication, String eventId, Throwable t); @Override void partitionsToCreate(EventPartitions eventPartitions); @Override void partitionsToAlter(EventPartitions eventPartitions); @PreDestroy void flush(); @Override void copierStart(String copierImplementation); @Override void resolvedReplicaLocation(URI location); @Override void existingReplicaPartitions(EventPartitions eventPartitions); @Override void deprecatedReplicaLocations(List<URI> locations); @Override void resolvedMetaStoreSourceTable(EventTable table); @Override void resolvedSourcePartitions(EventPartitions eventPartitions); @Override void resolvedSourceLocation(URI location); @Override void circusTrainShutDown(CompletionCode completionCode, Map<String, Long> metrics);  }### Answer:
@Test public void getModifiedPartitionsTypical() throws URISyntaxException { List<EventPartition> created = Arrays.asList(new EventPartition(Arrays.asList("a"), new URI("location_a"))); List<EventPartition> altered = Arrays.asList(new EventPartition(Arrays.asList("b"), new URI("location_b"))); List<List<String>> partitions = SnsListener.getModifiedPartitions(created, altered); assertThat(partitions.size(), is(2)); assertThat(partitions.get(0), is(Arrays.asList("a"))); assertThat(partitions.get(1), is(Arrays.asList("b"))); }
@Test public void getModifiedPartitionsOneOnly() throws URISyntaxException { List<EventPartition> created = Arrays .asList(new EventPartition(Arrays.asList("a"), new URI("location_a")), new EventPartition(Arrays.asList("b"), new URI("location_b"))); List<List<String>> partitions = SnsListener.getModifiedPartitions(created, null); assertThat(partitions.size(), is(2)); assertThat(partitions.get(0), is(Arrays.asList("a"))); assertThat(partitions.get(1), is(Arrays.asList("b"))); }
@Test public void getModifiedPartitionsBothNull() throws URISyntaxException { List<List<String>> partitions = SnsListener.getModifiedPartitions(null, null); assertThat(partitions, is(nullValue())); }