### Question:
ApiarySnsListener extends MetaStoreEventListener { @Override public void onAlterTable(AlterTableEvent event) throws MetaException { if (event.getStatus() == false) { return; } publishEvent(EventType.ALTER_TABLE, event.getNewTable(), event.getOldTable(), null, null); } 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 onAlterTable() throws MetaException { Table newTable = new Table(); newTable.setTableName("new_" + TABLE_NAME); newTable.setDbName(DB_NAME); newTable.setSd(newStorageDescriptor); newTable.setParameters(PARAMETERS); AlterTableEvent event = mock(AlterTableEvent.class); when(event.getStatus()).thenReturn(true); when(event.getOldTable()).thenReturn(table); when(event.getNewTable()).thenReturn(newTable); snsListener.onAlterTable(event); verify(snsClient).publish(requestCaptor.capture()); PublishRequest publishRequest = requestCaptor.getValue(); assertThat(publishRequest.getMessage(), is("{\"protocolVersion\":\"" + PROTOCOL_VERSION + "\",\"eventType\":\"" + EventType.ALTER_TABLE.toString() + "\",\"dbName\":\"some_db\",\"tableName\":\"new_some_table\",\"tableLocation\":\"s3: verifyMessageAttributes(publishRequest, EventType.ALTER_TABLE.toString(), "some_db", "new_some_table"); }