### Question:
ScopeNotificationFilter implements NotificationFilter { @Override public boolean matchesPreference(NotificationPreference preference) { return preference.getCategory().equals(NotificationPreferenceCategory.DEFAULT) && preference.getProperties().containsKey(NotificationPreferenceProperty.EVENT_TYPE); }  @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 ExpressionNode filterExpression(DocumentReference user,
            Collection<NotificationFilterPreference> filterPreferences, NotificationFilterType type,
            NotificationFormat format, Collection<NotificationPreference> preferences); @Override String getName(); static final String FILTER_NAME; }### Answer:
@Test void matchPreferenceWithCorrectPreference() throws Exception { NotificationPreference preference = mock(NotificationPreference.class); when(preference.getCategory()).thenReturn(NotificationPreferenceCategory.DEFAULT); when(preference.getProperties()).thenReturn( Collections.singletonMap(NotificationPreferenceProperty.EVENT_TYPE, "")); assertTrue(this.scopeNotificationFilter.matchesPreference(preference)); }
@Test void matchPreferenceWithIncorrectPreference() throws Exception { NotificationPreference preference = mock(NotificationPreference.class); when(preference.getCategory()).thenReturn(NotificationPreferenceCategory.SYSTEM); assertFalse(this.scopeNotificationFilter.matchesPreference(preference)); }