### Question:
TagNotificationFilter implements NotificationFilter { @Override public ExpressionNode filterExpression(DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationPreference preference) { return null; }  @Override FilterPolicy filterEvent(Event event, DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format); @Override boolean matchesPreference(NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationPreference preference); @Override ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilterType type,
            NotificationFormat format); @Override String getName(); static final String NAME; }### Answer:
@Test public void filterExpressionWithNotificationPreference() { assertNull(tagNotificationFilter.filterExpression(null, null, null)); }
@Test public void filterExpressionWithType() throws QueryException { assertNull(tagNotificationFilter.filterExpression(null, null, NotificationFilterType.INCLUSIVE, NotificationFormat.ALERT)); assertNull(tagNotificationFilter.filterExpression(null, Collections.emptyList(), NotificationFilterType.INCLUSIVE, null)); List<NotificationFilterPreference> preferenceList = Arrays.asList( new TagNotificationFilterPreference("foo", "mywiki"), new TagNotificationFilterPreference("bar", "otherwiki"), new TagNotificationFilterPreference("baz", "mywiki") ); Query query = mock(Query.class); when(this.queryManager.createQuery(any(), eq(Query.HQL))).thenReturn(query); List pagesHoldingTags = Arrays.asList("Page1", "Page2"); when(query.execute()).thenReturn(pagesHoldingTags); ExpressionNode filter = value(EventProperty.PAGE).inStrings(pagesHoldingTags) .and(value(EventProperty.WIKI).eq(value("mywiki"))); assertEquals(filter, tagNotificationFilter.filterExpression(null, preferenceList, NotificationFilterType.EXCLUSIVE, null)); verify(query).bindValue("tagList", Arrays.asList("foo", "bar", "baz")); verify(query).setWiki("mywiki"); }