### Question:
ApiarySnsListener extends MetaStoreEventListener { @Override public void onAlterPartition(AlterPartitionEvent event) throws MetaException { if (event.getStatus() == false) { return; } publishEvent(EventType.ALTER_PARTITION, event.getTable(), null, event.getNewPartition(), event.getOldPartition()); } ApiarySnsListener(Configuration config);   ApiarySnsListener(Configuration config, AmazonSNS snsClient); @Override void onCreateTable(CreateTableEvent event); @Override void onDropTable(DropTableEvent event); @Override void onAlterTable(AlterTableEvent event); @Override void onAddPartition(AddPartitionEvent event); @Override void onDropPartition(DropPartitionEvent event); @Override void onInsert(InsertEvent event); @Override void onAlterPartition(AlterPartitionEvent event);  }### Answer:
@Test public void onAlterPartitionUpdateLocation() throws MetaException { AlterPartitionEvent event = mock(AlterPartitionEvent.class); when(event.getStatus()).thenReturn(true); when(event.getTable()).thenReturn(table); Partition oldPartition = new Partition(PARTITION_VALUES, DB_NAME, TABLE_NAME, 0, 0, createStorageDescriptor(partitionKeys, OLD_PARTITION_LOCATION), ImmutableMap.of()); Partition newPartition = new Partition(PARTITION_VALUES, DB_NAME, TABLE_NAME, 0, 0, createStorageDescriptor(partitionKeys, PARTITION_LOCATION), ImmutableMap.of()); when(event.getOldPartition()).thenReturn(oldPartition); when(event.getNewPartition()).thenReturn(newPartition); snsListener.onAlterPartition(event); verify(snsClient).publish(requestCaptor.capture()); PublishRequest publishRequest = requestCaptor.getValue(); assertThat(publishRequest.getMessage(), is("{\"protocolVersion\":\"" + PROTOCOL_VERSION + "\",\"eventType\":\"" + EventType.ALTER_PARTITION.toString() + "\",\"dbName\":\"some_db\",\"tableName\":\"some_table\",\"tableLocation\":\"s3: }
@Test public void onAlterPartition() throws MetaException { AlterPartitionEvent event = mock(AlterPartitionEvent.class); when(event.getStatus()).thenReturn(true); when(event.getTable()).thenReturn(table); Partition oldPartition = new Partition(PARTITION_VALUES, DB_NAME, TABLE_NAME, 0, 0, createStorageDescriptor(partitionKeys, PARTITION_LOCATION), ImmutableMap.of()); Partition newPartition = new Partition(NEW_PARTITION_VALUES, DB_NAME, TABLE_NAME, 0, 0, createStorageDescriptor(partitionKeys, PARTITION_LOCATION), ImmutableMap.of()); when(event.getOldPartition()).thenReturn(oldPartition); when(event.getNewPartition()).thenReturn(newPartition); snsListener.onAlterPartition(event); verify(snsClient).publish(requestCaptor.capture()); PublishRequest publishRequest = requestCaptor.getValue(); assertThat(publishRequest.getMessage(), is("{\"protocolVersion\":\"" + PROTOCOL_VERSION + "\",\"eventType\":\"" + EventType.ALTER_PARTITION.toString() + "\",\"dbName\":\"some_db\",\"tableName\":\"some_table\",\"tableLocation\":\"s3: }