### Question:
CircusTrainReplicationMetaStoreEventListener implements ReplicationMetaStoreEventListener { public boolean canReplicate(String dbName, String tableName) { try { Table table = metaStoreClient.getTable(dbName, tableName); return table.getParameters().get(REPLICATION_EVENT.parameterName()) != null; } catch (NoSuchObjectException e) { return true; } catch (TException e) { throw new ShuntingYardException( String.format("Cannot check whether table %s.%s can be replicated", dbName, tableName), e); } } CircusTrainReplicationMetaStoreEventListener(
      CloseableMetaStoreClient metaStoreClient,
      ContextFactory contextFactory,
      CircusTrainRunner circusTrainRunner); boolean canReplicate(String dbName, String tableName); @Override void onEvent(MetaStoreEvent event);  }### Answer:
@Test public void canReplicateTable() { assertThat(listener.canReplicate(DATABASE, TABLE)).isTrue(); }
@Test public void canReplicateTableIfTableDoesNotExists() throws Exception { reset(metaStoreClient); when(metaStoreClient.getTable(DATABASE, TABLE)).thenThrow(NoSuchObjectException.class); assertThat(listener.canReplicate(DATABASE, TABLE)).isTrue(); }
@Test public void cannotReplicateTable() { tableParameters.clear(); listener.canReplicate(DATABASE, TABLE); }
@Test(expected = ShuntingYardException.class) public void cannotReplicateTableIfExceptionIsThrown() throws Exception { reset(metaStoreClient); when(metaStoreClient.getTable(DATABASE, TABLE)).thenThrow(TException.class); listener.canReplicate(DATABASE, TABLE); }