### Question:
WhitelistedListenerEventFilter implements ListenerEventFilter { @Override public boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType) { Map<String, String> tableParameters = listenerEvent.getTableParameters(); if (tableParameters != null && tableParameters.get(BEEKEEPER_HIVE_EVENT_WHITELIST) != null) { return !isWhitelisted(listenerEvent, tableParameters.get(BEEKEEPER_HIVE_EVENT_WHITELIST)); } return !isDefaultBehaviour(listenerEvent); }  @Override boolean isFiltered(ListenerEvent listenerEvent, LifecycleEventType lifecycleEventType); static final String BEEKEEPER_HIVE_EVENT_WHITELIST; }### Answer:
@Test public void filterNullTableParametersDefaultEvent() { when(listenerEvent.getEventType()).thenReturn(ALTER_TABLE); when(listenerEvent.getTableParameters()).thenReturn(null); boolean filter = listenerEventFilter.isFiltered(listenerEvent, UNREFERENCED); assertThat(filter).isFalse(); }
@Test public void filterEmptyTableParametersDefaultEvent() { when(listenerEvent.getEventType()).thenReturn(ALTER_TABLE); when(listenerEvent.getTableParameters()).thenReturn(Collections.emptyMap()); boolean filter = listenerEventFilter.isFiltered(listenerEvent, UNREFERENCED); assertThat(filter).isFalse(); }
@Test public void filterNullTableParametersNonDefaultEvent() { when(listenerEvent.getEventType()).thenReturn(DROP_TABLE); when(listenerEvent.getTableParameters()).thenReturn(null); boolean filter = listenerEventFilter.isFiltered(listenerEvent, UNREFERENCED); assertThat(filter).isTrue(); }
@Test public void filterEmptyTableParametersNonDefaultEvent() { when(listenerEvent.getEventType()).thenReturn(DROP_TABLE); when(listenerEvent.getTableParameters()).thenReturn(Collections.emptyMap()); boolean filter = listenerEventFilter.isFiltered(listenerEvent, UNREFERENCED); assertThat(filter).isTrue(); }