### Question:
DirectMessageStreamNotificationFilter implements NotificationFilter { @Override public boolean matchesPreference(NotificationPreference preference) { return DirectMessageDescriptor.EVENT_TYPE.equals(getEventType(preference)); }  @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(); @Override int getPriority();  }### Answer:
@Test public void matchesPreference() throws Exception { NotificationPreference notificationPreference = mock(NotificationPreference.class); Map<NotificationPreferenceProperty, Object> properties = new HashMap<>(); properties.put(NotificationPreferenceProperty.EVENT_TYPE, "directMessage"); when(notificationPreference.getProperties()).thenReturn(properties); assertTrue(mocker.getComponentUnderTest().matchesPreference(notificationPreference)); NotificationPreference notificationPreference2 = mock(NotificationPreference.class); Map<NotificationPreferenceProperty, Object> properties2 = new HashMap<>(); properties2.put(NotificationPreferenceProperty.EVENT_TYPE, "otherEventType"); when(notificationPreference2.getProperties()).thenReturn(properties2); assertFalse(mocker.getComponentUnderTest().matchesPreference(notificationPreference2)); }