### Question:
ApiarySnsListener extends MetaStoreEventListener { @Override public void onInsert(InsertEvent event) throws MetaException { if (event.getStatus() == false) { return; } publishInsertEvent(EventType.INSERT, event.getDb(), event.getTable(), event.getPartitionKeyValues(), event.getFiles(), event.getFileChecksums()); } 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 onInsert() throws MetaException { InsertEvent event = mock(InsertEvent.class); when(event.getStatus()).thenReturn(true); when(event.getTable()).thenReturn(TABLE_NAME); when(event.getDb()).thenReturn(DB_NAME); List<String> files = Arrays.asList("file:/a/b.txt", "file:/a/c.txt"); when(event.getFiles()).thenReturn(files); List<String> fileChecksums = Arrays.asList("123", "456"); when(event.getFileChecksums()).thenReturn(fileChecksums); Map<String, String> partitionKeyValues = new HashMap<>(); partitionKeyValues.put("load_date", "2013-03-24"); partitionKeyValues.put("variant_code", "EN"); when(event.getPartitionKeyValues()).thenReturn(partitionKeyValues); snsListener.onInsert(event); verify(snsClient).publish(requestCaptor.capture()); PublishRequest publishRequest = requestCaptor.getValue(); assertThat(publishRequest.getMessage(), is("{\"protocolVersion\":\"" + PROTOCOL_VERSION + "\",\"eventType\":\"" + EventType.INSERT.toString() + "\",\"dbName\":\"some_db\",\"tableName\":\"some_table\",\"files\":[\"file:/a/b.txt\",\"file:/a/c.txt\"]," + "\"fileChecksums\":[\"123\",\"456\"],\"partitionKeyValues\":{\"load_date\":\"2013-03-24\",\"variant_code\":\"EN\"}}")); verifyMessageAttributes(publishRequest, EventType.INSERT.toString(), "some_db", "some_table"); }